如果我有这些字符串:
"abc" = false
"123" = true
"ab2" = false
是否有一个命令,比如IsNumeric()或其他东西,可以识别字符串是否是有效数字?
我想知道C#如何检查一个字符串是否是一个数字(只是一个数字).
示例:
141241 Yes
232a23 No
12412a No
Run Code Online (Sandbox Code Playgroud)
等等...
有特定的功能吗?
如何检查字符串是否为数字.我正在验证手机号码,它应该有10位数字,并且只能采用数字格式.
string str="9848768447"
if(str.Length==10 && Here I need condition to check string is number or not)
{
//Code goes here
}
Run Code Online (Sandbox Code Playgroud)
我是编程新手.请帮我