方案三:遍历
a)
复制代码 public bool isnumeric(string str)
{
char[] ch=new char[str.Length];
ch=str.ToCharArray();
for(int i=0;i {
if(ch[i]<48 || ch[i]>57)
return false;
}
return true;
}
b)
复制代码 public bool IsInteger(string strIn) {
bool bolResult=true;
if(strIn=="") {
bolResult=false;
}
else {
foreach(char Char in strIn) {
if(char.IsNumber(Char))
continue;
else {
bolResult=false;
break;
}
}
}
return bolResult;
}
c)
复制代码 public static bool isNumeric(string inString)
{
inString = inString.Trim();
bool haveNumber = false;
bool haveDot = false;
for (int i = 0; i < inString.Length; i++)
{
if (Char.IsNumber(inString[i]))
{
haveNumber = true;
}
else if (inString[i] == '.')
{
if (haveDot)
{










