Sat 19 Jul 2008
isNumeric String Checker
Posted by admin under CSharp Commands |
Here is a way to check if a string is a number:-
public static bool isNumeric(string val, System.Globalization.NumberStyles NumberStyle) { Double result; return Double.TryParse(val, NumberStyle, System.Globalization.CultureInfo.CurrentCulture, out result); }
Here is a link so you can figure out what to put in the “NumberStyle” field.
http://msdn.microsoft.com/en-us/library/system.globalization.numberstyles.aspx
No Responses to “ isNumeric String Checker ”
Comments:
Leave a Reply
You must be logged in to post a comment.