is Whitespace Letter - Java java.lang

Java examples for java.lang:char

Description

is Whitespace Letter

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        char ch = 'a';
        System.out.println(isWhitespace(ch));
    }//from w ww.j  a  va  2s. c o  m

    public static boolean isWhitespace(char ch) {
        // return Character.isWhitespace(ch);

        switch (ch) {
        case ' ':
        case '\t':
        case '\n':
        case '\r':
            // what else?
            return true;
        }
        return false;
    }
}

Related Tutorials