判断是否是数字
2008-02-14 17:03
190 查看
1 private bool IsNumeric(string str)
7 {
8 if (str == null || str.Length == 0)
9 return false;
10 System.Text.ASCIIEncoding ascii = new System.Text.ASCIIEncoding();
11 byte[] bytestr = ascii.GetBytes(str);
12 foreach (byte c in bytestr)
13 {
14 if (c < 48 || c > 57)
15 {
16 return false;
17 }
18 }
19 return true;
20 }
7 {
8 if (str == null || str.Length == 0)
9 return false;
10 System.Text.ASCIIEncoding ascii = new System.Text.ASCIIEncoding();
11 byte[] bytestr = ascii.GetBytes(str);
12 foreach (byte c in bytestr)
13 {
14 if (c < 48 || c > 57)
15 {
16 return false;
17 }
18 }
19 return true;
20 }
相关文章推荐
- Java判断字符串是否为数字
- 判断字符串是否为数字
- leetcode:Palindrome Number (判断数字是否回文串) 【面试算法题】
- JS判断是否为数字、JS判断是否为整数、JS判断是否为浮点数
- delphi 判断一个字符串是否只由数字组成
- C#中判断是否为数字
- 判断一个String型字符串是否得数字
- 通过正则表达式来判断字符串是否为数字组成的
- 判断C#中的字符串是否是数字,如果是转换成int类型
- Swift 判断是否是数字
- SQL Server 判断是否为数字的函数
- 判断NSString是否为数字,以及转换为数字
- PHP判断字符是否为字母/数字检测/password_hash密码加密
- 判断字符串是否为数字(测试版)
- 判断输入的是否是数字?
- 使用event.keyCode来判断是否为数字
- Python 判断字符串是否为数字
- c#判断输入文字是否是数字
- hascode 之 如何判断两个数是否可以颠倒数字顺序得到
- Python学习笔记——判断输入内容是否为数字