在c#.net中检查字符串是否为数字 [英] check string is numeric or not in c# .net

查看:57
本文介绍了在c#.net中检查字符串是否为数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有工作isnumeric函数。

告诉我用哪个函数检查字符串是否为数字

THERE IS not work isnumeric function.
tell me which function i use to check the string is numeric or not

推荐答案

看看在这篇文章:



检查字符串值是否为数字 [ ^ ]







http://www.bytechaser.com/en/ functions / hqb72zcn9k / isnumeric-test-if-string-is-numeric-in.aspx [ ^ ]
Look at this Article:

Check If A String Value Is Numeric[^]

and

http://www.bytechaser.com/en/functions/hqb72zcn9k/isnumeric-test-if-string-is-numeric-in.aspx[^]


你可以使用 TryParse ()参见: http://msdn.microsoft.com/en-us/library/9zbda557.aspx [ ^ ]
You can use TryParse() see : http://msdn.microsoft.com/en-us/library/9zbda557.aspx[^]


使用数值数据类型的TryParse()函数,具体取决于您需要的特定类型。例如,

use the TryParse() functions of numeric data types, depending on the specific type you need. E.g.
int result;
if (int.TryParse(myString, out result))
{
    //ok, do something
}
else
{
    //not an int
}


这篇关于在c#.net中检查字符串是否为数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆