of test that detects whether the characters entered are 0 9

  • 2020-05-27 06:55:18
  • OfStack

 
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[i] < ' 0 ' || char[i] > ' 9 ') 
{ 
flag=false; 
break; 
} 
} 
return flag; 
} 

Related articles: