代码
1 /// <summary>
2 /// 提取字符串中的数字字符串
3 /// </summary>
4 /// <param name="str"></param>
5 /// <returns></returns>
6 public static string IsNumber(String str)
7 {
8 string returnStr = string.Empty;
9 for (int i = 0; i < str.Length; i++)
10 {
11 if (Char.IsNumber(str, i) == true)
12 {
13 returnStr += str.Substring(i, 1);
14 }
15 else
16 {
17 if (str.Substring(i, 1) == "A" || str.Substring(i, 1) == " ")
18 {
19 returnStr += str.Substring(i, 1);
20 }
21 }
22
23 }
24 return returnStr;
25 }
2 /// 提取字符串中的数字字符串
3 /// </summary>
4 /// <param name="str"></param>
5 /// <returns></returns>
6 public static string IsNumber(String str)
7 {
8 string returnStr = string.Empty;
9 for (int i = 0; i < str.Length; i++)
10 {
11 if (Char.IsNumber(str, i) == true)
12 {
13 returnStr += str.Substring(i, 1);
14 }
15 else
16 {
17 if (str.Substring(i, 1) == "A" || str.Substring(i, 1) == " ")
18 {
19 returnStr += str.Substring(i, 1);
20 }
21 }
22
23 }
24 return returnStr;
25 }