help.java

来自「适合学生课程设计使用,这是我自己编写的一个系统.」· Java 代码 · 共 33 行

JAVA
33
字号
package tools;

public class help {
	public static boolean isEmpty(String str) {				//判断字符串是否为空
		boolean bool = true;
		if(str != null) {
			if(str.equals("") || str.length() == 0 || str == null) {
			} else {
				bool = false;
			}	
		}
		return bool;
	}
	
	public static boolean isNumber(String str) {			//判断字符串是否为数字
		boolean bool = false;
		try {
			int i = Integer.parseInt(str);
			bool = true;
		} catch(Exception e) {
			System.out.println("Error(isNumber):" + e.toString());
		}
		
		return bool;
	}
	
	public static void main(String[] args) {			//测试用
		String str = "12ggf";
		System.out.println(help.isNumber(str));
		System.out.println("asdfasdfasfdasf");
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?