Does string contain White Space - Android java.lang

Android examples for java.lang:String Null or Empty

Description

Does string contain White Space

Demo Code


public class Main{

    public static boolean containsWhiteSpace(final String testCode) {
        if (testCode != null) {
            for (int i = 0; i < testCode.length(); i++) {
                if (Character.isWhitespace(testCode.charAt(i))) {
                    return true;
                }//w  w w  .  jav a 2 s  . co  m
            }
        }
        return false;
    }

}

Related Tutorials