Tuesday, May 24, 2011

Check If A String Value Is Numeric or Not

Following is the example for testing string value as number or not
            string str123 = "1245"
               Double res = 0;
            bool b12=Double.TryParse(str123, out res);
this will return true. for the above example. If however, str123="123ab" then the above code will return false.

             

No comments:

Post a Comment