Export (0) Print
Expand All

Char.ConvertToUtf32 Method (String, Int32)

Converts the value of a UTF-16 encoded character or surrogate pair at a specified position in a string into a Unicode code point.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

static member ConvertToUtf32 : 
        s:string * 
        index:int -> int

Parameters

s
Type: System.String

A string that contains a character or surrogate pair.

index
Type: System.Int32

The index position of the character or surrogate pair in s.

Return Value

Type: System.Int32
The 21-bit Unicode code point represented by the character or surrogate pair at the position in the s parameter specified by the index parameter.

ExceptionCondition
ArgumentNullException

s is a null reference (Nothing in Visual Basic).

ArgumentOutOfRangeException

index is not a position within s.

ArgumentException

The specified index position contains a surrogate pair, and either the first character in the pair is not a valid high surrogate or the second character in the pair is not a valid low surrogate.

Use this method to convert a character or surrogate pair into a 21-bit Unicode code point. To convert UTF-16 data into UTF-32 data, use the System.Text.UTF32Encoding class.

The following code example demonstrates the ConvertToUtf32 and ConvertFromUtf32 methods.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft