You are not Logged in Would you like to Login or Register
Today is: Wednesday, 07 January, 2009 Check this months hot topics
.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; }
Don't forget Int32.TryParse()
Example usage :
int someNumber; if (!Int32.TryParse(s, out someNumber)) { // Not an int }
Another example:
int classificationID = 0;
int.TryParse("123", out classificationID);
Enter your comment below and it will be submitted for moderation.
Please enter tags for this article, seperated by semi-colon ;