Java String Whitespace Clean cleanWhiteSpace(String s, boolean all)

Here you can find the source of cleanWhiteSpace(String s, boolean all)

Description

clean White Space

License

Open Source License

Declaration

public static String cleanWhiteSpace(String s, boolean all) 

Method Source Code

//package com.java2s;

public class Main {
    public static String cleanWhiteSpace(String s, boolean all) {
        if (s == null) {
            return null;
        }/*from   w  ww.  ja v a 2s.c o m*/
        s = s.trim();
        if (all) {
            s = s.replaceAll("\\s+", "");
        }
        return s;
    }

    public static String cleanWhiteSpace(String s) {
        return cleanWhiteSpace(s, true);
    }
}

Related

  1. cleanWhitespace(String definition)
  2. cleanWhitespace(String in)
  3. cleanWhitespace(String str)
  4. cleanWhitespace(String string)
  5. cleanWhitespaceAndIndentation(String s, String indent)
  6. cleanWhitespaces(String string)