private static boolean isNumeric(String str)
{
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(str);
if( !isNum.matches() )
{
return false;
}
return true;
}
判断字符串是否数字
正则表达式检查字符串是否全为数字
本文介绍了一种使用正则表达式的方法来判断一个字符串是否完全由数字组成,包括整数和小数。

被折叠的 条评论
为什么被折叠?



