📜  c#如何检查字符串是数字 - C#代码示例

📅  最后修改于: 2022-03-11 14:49:06.959000             🧑  作者: Mango

代码示例1
string s1 = "123";
string s2 = "abc";

bool isNumber = int.TryParse(s1, out int n); // returns true
isNumber = int.TryParse(s2, out int n); // returns false