Hi,
You can use:
bool IsInteger(string s)
{
try
{
int n = int.Parse(s);
return true;
}
catch
{
return false;
}
This will accept a '+' or '-' sign in front of a number. If you don't want
that, you could write your own function:
bool IsInteger(string s)
{
for (int i = 0; i < s.Length; i++)
if (s[i] < '0' || s[i] > '9')
return false;
return true;
}
Check against a regular expression could be another solution.
Regards - Octavio
"ad" <ad@wfes.tcc.edu.tw> escribió en el mensaje
news:Ol**************@TK2MSFTNGP14.phx.gbl...
How to check a string if this string is composite of number?