jetbrick-commons/src/main/java/jetbrick/lang/StringUtils.java
public static String deleteWhitespace(final String s) {
        if (isEmpty(s)) {
            return s;
        }
        final int sz = s.length();
        final char[] chs = new char[sz];
        int count = 0;
        for (int i = 0; i < sz; i++) {
            if (!Character.isWhitespace(s.charAt(i))) {
                chs[count++] = s.charAt(i);
            }
        }
        if (count == sz) {
            return s;
        }
        return new String(chs, 0, count);
    }
public static String deleteWhitespace(final String s) {
        if (isEmpty(s)) {
            return s;
        }
        final int sz = s.length();
        final char[] chs = new char[sz];
        int count = 0;
        for (int i = 0; i < sz; i++) {
            if (!Character.isWhitespace(s.charAt(i))) {
                chs[count++] = s.charAt(i);
            }
        }
        if (count == sz) {
            return s;
        }
        return new String(chs, 0, count);
    }
public static String deleteWhitespace ( final String s ) { if ( isEmpty ( s ) ) { return s ; } final int sz = s . length ( ) ; final char [ ] chs = new char [ sz ] ; int count = 0 ; for ( int i = 0 ; i < sz ; i ++ ) { if ( ! Character . isWhitespace ( s . charAt ( i ) ) ) { chs [ count ++ ] = s . charAt ( i ) ; } } if ( count == sz ) { return s ; } return new String ( chs , 0 , count ) ; }
<p>
Deletes all whitespaces from a String as defined by
{@link Character#isWhitespace(char)}.
</p>

<pre>
StringUtils.deleteWhitespace(null)         = null
StringUtils.deleteWhitespace("")           = ""
StringUtils.deleteWhitespace("abc")        = "abc"
StringUtils.deleteWhitespace("   ab  c  ") = "abc"
</pre>

@param s
the String to delete whitespace from, may be null
@return the String without whitespaces, {@code null} if null String input
<p > Deletes all whitespaces from a String as defined by { @link Character#isWhitespace ( char ) } . < / p >