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.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version