Java判断字符串是否全由数字组成

public class RegxUtils {
	/**
	 * 输入字符串是否全由数字组成
	 * @param str
	 * @return
	 */
	public boolean isNumeric(String str) {
		Pattern pattern = Pattern.compile("[0-9]*");
		Matcher isNum = pattern.matcher(str);
		if (!isNum.matches()) {
			return false;
		}
		return true;
	}
}

猜你喜欢

转载自irwenqiang.iteye.com/blog/1217716