📄 stringtool.java
字号:
/**
*******************************************************************************
* StringTool.java
*
* (c) Copyright 2008 Hewlett-Packard Development Company, L.P.
*
*<Program Content>
* System Name : Students Management System
*<Summarize>
* The file includes a class and the main function of the class is to judge
* whether a string is null or empty or made up by space characters.
*<Update Record>
* 2009-4-18 1.00 zhangliy
*******************************************************************************
*/
package com.hp.eds.zhangliyuan.stuMan.util;
/**
* The class main function is to judge whether a string is null or empty or made
* up by space characters.
*
* @author zhangliy
* @version 1.0
*/
public class StringTool {
/**
* judge whether a string is null or empty or made up by space characters.
*
* @param string
* -the string needs to be judged
* @return boolean(true:the string is null or empty or made up by space
* characters;false:the string is not empty)
*/
public static boolean isStringEmpty(String string) {
if (string == null || string.length() == 0) {
// the string is null or its length is 0
return true;
}
for (int i = 0; i < string.length(); i++) {
if (string.charAt(i) == ' ') {
// the character is space
continue;
} else {
// the character is not space,return false
return false;
}
}
// the string is made up by space characters,return false
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -