Mostly some of us tries to avoid using Regex as compared to available built in function, including me😬
Char.isDigit() method is one of the approaches to go about. In C#, Char.isDigit() is a System.Char struct method that verifies if each Unicode character is a number.
Another way to check for numeric format is by using the TryParse() method. TryParse(string inputString, out double value) method tries to parse input string and if the value can be parsed then returns true and converts the value else it returns false.
If we want to validate a string for its alphabetic form then we can use Char.isLetter() method. Char.isLetter() is a System.Char struct method that verifies if each Unicode character is a number.
If we want to validate a string over combination of alphabets and numbers then there is still an option of using Char.isLetterOrDigit() method. Char.isLetterOrDigit() is a System.Char struct method that verifies if each Unicode character is a letter or number.
If the code do not demands pattern matching but only determining data type then we can achieve it using Char struct methods.