GeekZilla
IsNumeric
.NET is missing an IsNumeric function (for c# users anyway). It's dead simple to write one though:
private bool IsNumeric(string s) { try {Int32.Parse(s);} catch {return false;} return true; }
Author Lee Keable
Comments
Paul Hayman
said:
Don't forget Int32.TryParse()
Example usage :
int someNumber; if (!Int32.TryParse(s, out someNumber)) { // Not an int }
Paul Hayman
said:
Another example:
int classificationID = 0;
int.TryParse("123", out classificationID);