C# UInt32 Parse(String, IFormatProvider)
Description
UInt32 Parse(String, IFormatProvider)
converts the
string representation of a number in a specified culture-specific format
to its 32-bit unsigned integer equivalent.
Syntax
UInt32.Parse(String, IFormatProvider)
has the following syntax.
[CLSCompliantAttribute(false)]// w w w . j a v a2s.co m
public static uint Parse(
string s,
IFormatProvider provider
)
Parameters
UInt32.Parse(String, IFormatProvider)
has the following parameters.
s
- A string that represents the number to convert.provider
- An object that supplies culture-specific formatting information about s.
Returns
UInt32.Parse(String, IFormatProvider)
method returns A 32-bit unsigned integer equivalent to the number specified in s.
Example
using System.Globalization;
using System;/*from w ww. ja v a 2s .c o m*/
public class MainClass{
public static void Main(String[] argv){
string locale;
uint number;
CultureInfo culture = new CultureInfo("en-US");
try
{
number = UInt32.Parse("123", culture.NumberFormat);
}
catch (FormatException)
{
return;
}
catch (Exception)
{
return;
}
}
}
The code above generates the following result.