To find out if a given string is integer or not in C Sharp use the Int32.TryParse() method. Returns a boolean value: if it is true then the string is recognized as an integer number, if it returns false then the conversion did not succeed.
All the other numeric types have a TryParse() method.
Do NOT use the methods discovered by this guy because to throw an exception takes time. Also his character iteration method is not useful if we would like to parse a negative integer or a number that contains thousand separators. (He claims to be a Microsoft certified Team Leaded. For crying out loud... I mean come on...)
2008-01-31
How NOT to find out if a given string is integer or not in C Sharp
Subscribe to:
Post Comments (Atom)
1 comment:
Well, you should take a look at this http://www.youngestmcp.com/
This kid seems to be certified at the age of 9. I am sorry to say this, but this tells me more about the quality of the MS certification that it tells me about the skills of this kid.
Post a Comment