UInt32.Parse(String) Method is used to convert the string representation of a number to its 32-bit unsigned integer equivalent.
Syntax:
public static uint Parse (string str);
Here,
str is a string containing a number to convert. The format of
str will be
[optional white space][optional sign]digits[optional white space]. The sign can be positive or negative. But negative sign can be used only with zero otherwise it will throw an
OverflowException.
Return Value: It is a 32-bit unsigned integer equivalent to the number contained in
str.
Exceptions:
- ArgumentNullException: If str is null.
- FormatException: If str is not in the correct format.
- OverflowException: If str represents a number less than MinValue or greater than MaxValue.
Below programs illustrate the use of above-discussed method:
Example 1:
Output:
'4294967295' parsed as 4294967295
Can't Parsed '14244, 784'
Can't Parsed '-457589'
' 784845' parsed as 784845
Example 2: For
ArgumentNullException