UInt32.TryParse Method (String, UInt32)
Tries to convert the string representation of a number to its 32-bit unsigned integer equivalent. A return value indicates whether the conversion succeeded or failed.
This API is not CLS-compliant.
Assembly: mscorlib (in mscorlib.dll)
[<CLSCompliantAttribute(false)>] static member TryParse : s:string * result:uint32 byref -> bool
A string that represents the number to convert.
When this method returns, contains the 32-bit unsigned integer value that is equivalent to the number contained in s, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is null or String.Empty, is not of the correct format, or represents a number that is less than UInt32.MinValue or greater than UInt32.MaxValue. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.
Return ValueType: System.Boolean
true if s was converted successfully; otherwise, false.
The Parse method, except that it does not throw an exception if the conversion fails. This method eliminates the need to use exception handling to test for a FormatException if s is invalid and cannot be successfully parsed.method is like the
The s parameter should be the string representation of a decimal number in the following form:
Elements in square brackets ([ and ]) are optional. The following table describes each element.
Optional white space.
A sequence of decimal digits ranging from 0 to 9.
The s parameter is interpreted by using the NumberStyles.Integer style. In addition to the decimal digits, only leading and trailing spaces with a leading sign are allowed. To explicitly define the style elements with the culture-specific formatting information that can be present in s, call the TryParse(String, NumberStyles, IFormatProvider, UInt32) method.
The string specified by the s parameter cannot contain any group separators or decimal separator, and it cannot have a fractional portion.
This overload interprets all digits in the s parameter as decimal digits. To parse the string representation of a hexadecimal number, call the TryParse(String, NumberStyles, IFormatProvider, UInt32) overload instead.
Available since 8
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8.1