Please use the Regular Expression, for example:using System.Text.RegularExpressions; .... Regex myRex = new Regex("^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$"); String s = "123.345"; Match m = myRex.Match(s); if ( m.Success ) { //Success // Console.WriteLine("OK"); } else { //Failed } ....---------------------------------------- I like to teach a fish how to swim.
jdpopo(破破) 的是最佳答案,同时也感谢TheAres(喜欢教鱼游泳), 散分了
I don't agree with you guys, please see my question?With jdpopo's answer,Is "100.11" a number? Yes. But you will get the answer"不是数字"Is "99999999999999999" a nuber? Yes. But you will get the answer"不是数字"Please try my answer, evan you try the "1.3e22", this is also a number.Please show your patient to yourself when you ask questions. ------------------------------------------ I like to teach a fish how to swim.
....
Regex myRex = new Regex("^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$");
String s = "123.345";
Match m = myRex.Match(s); if ( m.Success )
{
//Success
// Console.WriteLine("OK");
}
else
{
//Failed
}
....----------------------------------------
I like to teach a fish how to swim.
散分了
------------------------------------------
I like to teach a fish how to swim.