Example usage for org.apache.commons.lang3 StringUtils deleteWhitespace

List of usage examples for org.apache.commons.lang3 StringUtils deleteWhitespace

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils deleteWhitespace.

Prototype

public static String deleteWhitespace(final String str) 

Source Link

Document

Deletes all whitespaces from a String as defined by Character#isWhitespace(char) .

 StringUtils.deleteWhitespace(null)         = null StringUtils.deleteWhitespace("")           = "" StringUtils.deleteWhitespace("abc")        = "abc" StringUtils.deleteWhitespace("   ab  c  ") = "abc" 

Usage

From source file:wo.trade.Util.java

public static String removeThoseDamnWhiteSpace(String s) {
    s = StringUtils.deleteWhitespace(s);
    StringBuilder sb = new StringBuilder();
    char[] charArray = s.toCharArray();
    for (char c : charArray) {
        if (!Character.isSpaceChar(c)) {
            sb.append(c);/*from   w ww  .  j  a v  a 2 s.  c  o  m*/
        }
    }
    return sb.toString();
}