检测输入的字符是否为0-9的数字(测试)
public static boolean isNum(String str)
{
boolean flag=true;
if(str.length()==0)
flag=false;
char[] ch=str.toCharArrary();
for( int i=0; i<ch.length;i++)
{
if(ch < ' 0 ' || char > ' 9 ')
{
flag=false;
break;
}
}
return flag;
}
https://www.uoften.com/program/jsp/20180413/47625.html
页:
[1]