asp.net verifies that the string is a pure numeric detection function

  • 2020-05-09 18:26:42
  • OfStack


#region  A way to determine if it is a number  
public bool isnumeric(string str) 
{ 
char[] ch=new char[str.Length]; 
ch=str.ToCharArray(); 
for(int i=0;i<ch.Length;i++) 
{ 
if(ch[i]<48 || ch[i]>57) 
return false; 
} 
return true; 
} 
#endregion 


Related articles: