标题:检验判断是否是数字
取消只看楼主
hexiemoling
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-7-3
 问题点数:0 回复次数:0 
检验判断是否是数字

private 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;

}

搜索更多相关主题的帖子: 数字 str byte return ascii 
2007-07-03 22:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-152479-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.734466 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved