remove White Spaces by regex - Android java.util.regex

Android examples for java.util.regex:Blank Remove

Description

remove White Spaces by regex

Demo Code


public class Main{

    public static String removeWhiteSpaces(String str) {
        return str.replaceAll("\\s+", " ");
    }/*from  w w w  . j  av a  2  s.  c  om*/

}

Related Tutorials