ConvertToUtf32 Method (String, Int32)
Collapse the table of content
Expand the table of content

Char.ConvertToUtf32 Method (String, Int32)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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)

public static int ConvertToUtf32(
	string s,
	int index


Type: System.String
A string that contains a character or surrogate pair.
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.


s is null.


index is not a position within s.


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.

The following code example demonstrates the ConvertToUtf32 and ConvertFromUtf32 methods.

Windows Phone OS

Supported in: 8.1, 8.0

© 2016 Microsoft