C#判断字符串是否为全数字 或与且与或非 2022-09-22 189 阅读1分钟 C#判断字符串是否为全数字 /// <summary> /// 判断字符串是否是数字 /// </summary> public static bool IsNumber(string s) { if (string.IsNullOrWhiteSpace(s)) return false; const string pattern = "^[0-9]*$"; Regex rx = new Regex(pattern); return rx.IsMatch(s); } 转载自:www.cnblogs.com/zhang625161…