![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
public
static bool
IsNumeric
(string
str
)
{
if ( str == null || str .Length == 0 )
return false;
System. Text .ASCIIEncoding ascii = new System. Text .ASCIIEncoding();
byte [] bytestr = ascii .GetBytes( str );
foreach (byte c in bytestr)
{
if (c < 48 || c > 57 )
{
return false;
}
}
return true;
}
{
if ( str == null || str .Length == 0 )
return false;
System. Text .ASCIIEncoding ascii = new System. Text .ASCIIEncoding();
byte [] bytestr = ascii .GetBytes( str );
foreach (byte c in bytestr)
{
if (c < 48 || c > 57 )
{
return false;
}
}
return true;
}