1 // <summary> 2 /// 提取字符串中的数字字符串 3 /// </summary> 4 /// <param name="str"></param> 5 /// <returns></returns> 6 public static bool IsNumber(String str) 7 { 8 bool result = false; 9 for (int i = 0; i < str.Length; i++) 10 { 11 if (Char.IsNumber(str, i)) 12 { 13 result = false; 14 } 15 else 16 { 17 result = true; 18 } 19 } 20 return result; 21 } 22 23 /// <summary> 24 /// 判断是否是数字还是自负串 25 /// </summary> 26 /// <param name="str"></param> 27 /// <returns></returns> 28 private bool IsNumeric(string str) 29 { 30 31 foreach (char c in str) 32 { 33 if (!Char.IsNumber(c)) 34 { 35 return false; 36 } 37 } 38 return true; 39 } 40 41 收藏于 2010-09-16
原文地址:https://www.cnblogs.com/dqh123/p/9470143.html
时间: 2024-11-18 12:41:06