Use Integer.TryParse (), it will return true if there are only digits in the string. The maximum value of Int32 is 2,147,483,647, so if your value is less, then your penalty.
http://msdn.microsoft.com/en-us/library/f02979c7.aspx
You can also use Double.TryParse (), which has a maximum value of 1.7976931348623157E + 308, but it will have a decimal point.
, , .
string test = "1112003212g1232";
int result;
bool append=true;
for (int i = 0; i < test.Length-1; i++)
{
if(!Int32.TryParse(test.Substring(i,i+1),out result))
{
append = false;
}
}
append true, . , , .