I need to make a number validation for specified string. The problem is, the string could be a large number, larger than any numeric type in C# can represent, so I can't use TryParse functions, because they will give only information about whether they can convert to those types.
It should take into account -/+, separator, and current culture settings.
I found some solutions using regular expressions, but all of them miss some details. And I'm not good at regular expressions
You can use BigInteger
if you are using C# 4.0 and the numbers are integers.
It Represents an arbitrarily large signed integer.
Use the TryParse
method to avoid the possible exception from Parse
(unless you are certain that the passed in string will always be a valid integer).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With