private static String mungeCharName(String source) {
        source = PatternProps.trimWhiteSpace(source);
        StringBuilder buf = null;
        for (int i=0; i<source.length(); ++i) {
            char ch = source.charAt(i);
            if (PatternProps.isWhiteSpace(ch)) {
                if (buf == null) {
                    buf = new StringBuilder().append(source, 0, i);
                } else if (buf.charAt(buf.length() - 1) == ' ') {
                    continue;
                }
                ch = ' '; // convert to ' '
            }
            if (buf != null) {
                buf.append(ch);
            }
        }
        return buf == null ? source : buf.toString();
    }
private static String mungeCharName ( String source ) { source = PatternProps . trimWhiteSpace ( source ) ; StringBuilder buf = null ; for ( int i = 0 ; i < source . length ( ) ; ++ i ) { char ch = source . charAt ( i ) ; if ( PatternProps . isWhiteSpace ( ch ) ) { if ( buf == null ) { buf = new StringBuilder ( ) . append ( source , 0 , i ) ; } else if ( buf . charAt ( buf . length ( ) - 1 ) == ' ' ) { continue ; } ch = ' ' ; } if ( buf != null ) { buf . append ( ch ) ; } } return buf == null ? source : buf . toString ( ) ; }
Remove leading and trailing Pattern_White_Space and compress
internal Pattern_White_Space to a single space character.