Java Regex String Replace Whitespace replaceBlank(String str)

Here you can find the source of replaceBlank(String str)

Description

replace Blank

License

Open Source License

Declaration

public static String replaceBlank(String str) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static String replaceBlank(String str) {
        if (str != null) {
            Pattern p = Pattern.compile("\t|\r|\n");
            Matcher m = p.matcher(str);
            return m.replaceAll("").trim();
        }/*from www .jav  a  2  s . co  m*/

        return null;
    }

    public static String trim(String name) {
        if (null != name) {
            return name.trim();
        }
        return null;
    }
}

Related

  1. replaceBlank(String str)
  2. replaceBlank(String str)
  3. replaceBlank(String str)
  4. replaceWhitespace(final String value, final boolean stripExtras)
  5. replaceWhitespace(final String value, final boolean stripExtras)