Android String Whitespace Check isWhitespace(String text)

Here you can find the source of isWhitespace(String text)

Description

is Whitespace

Declaration

public static boolean isWhitespace(String text) 

Method Source Code

//package com.java2s;

public class Main {
    public static final String ATAB = String.valueOf('\u0009');
    public static final String ASPACE = " ";

    public static boolean isWhitespace(String text) {
        //String ret = "";
        boolean ret = true;
        char chTemp;
        String strTemp;/*from   www .  ja v a 2s . c o  m*/
        boolean boolA, boolB, boolC;
        for (int i = 0; i < text.length(); i++) {
            boolA = false;
            boolB = false;
            chTemp = text.charAt(i);
            strTemp = String.valueOf(chTemp);
            boolA = strTemp.equals(ASPACE);
            boolB = strTemp.equals(ATAB);
            boolC = strTemp.equals("\n");
            if (boolA || boolB || boolC)
                ;
            else
                return false;
        }
        //TestInfo.testWriteLn("Indent: " + ret);
        return ret;
    }
}

Related

  1. isWhitespace(int c)
  2. isWhitespace(int c)