首页 > Windows开发 > 详细

C#判断字符串是否是数字

时间:2016-12-24 13:32:55      阅读:253      评论:0      收藏:0      [点我收藏+]
 1 /// <summary>
 2 /// 判断字符串是否是数字
 3 /// </summary>
 4 public static bool IsNumber(string s)
 5 {
 6     if (string.IsNullOrWhiteSpace(s)) return false;
 7     const string pattern = "^[0-9]*$";
 8     Regex rx = new Regex(pattern);
 9     return rx.IsMatch(s);
10 }

 

C#判断字符串是否是数字

原文:http://www.cnblogs.com/zhang625161495/p/6216992.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!