Java isWhitespace() 方法
Java 教程
· 2019-02-08 17:29:52
isWhitespace() 方法用于判断指定字符是否为空白字符,空白符包含:空格、tab键、换行符。
语法
boolean isWhitespace(char ch)
参数
ch -- 要测试的字符。
返回值
如果字符为空白字符,则返回 true;否则返回 false。
实例
public class Test {
public static void main(String args[]) {
System.out.println(Character.isWhitespace('c'));
System.out.println(Character.isWhitespace(' '));
System.out.println(Character.isWhitespace('\n'));
System.out.println(Character.isWhitespace('\t'));
}
}
以上程序执行结果为:
false true true true
点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html
Big Java Late Objects
Horstmann, Cay S. / 2012-2 / 896.00元
The introductory programming course is difficult. Many students fail to succeed or have trouble in the course because they don't understand the material and do not practice programming sufficiently. ......一起来看看 《Big Java Late Objects》 这本书的介绍吧!