Character.ToChars Method

Definition

Overloads

ToChars(Int32, Char[], Int32)

Converts the specified character (Unicode code point) to its UTF-16 representation.

ToChars(Int32)

Converts the specified character (Unicode code point) to its UTF-16 representation stored in a char array.

ToChars(Int32, Char[], Int32)

Converts the specified character (Unicode code point) to its UTF-16 representation.

[Android.Runtime.Register("toChars", "(I[CI)I", "")]
public static int ToChars (int codePoint, char[]? dst, int dstIndex);
[<Android.Runtime.Register("toChars", "(I[CI)I", "")>]
static member ToChars : int * char[] * int -> int

Parameters

codePoint
Int32

the character (Unicode code point) to be converted.

dst
Char[]

an array of char in which the codePoint's UTF-16 value is stored.

dstIndex
Int32

the start index into the dst array where the converted value is stored.

Returns

1 if the code point is a BMP code point, 2 if the code point is a supplementary code point.

Attributes

Exceptions

if codePoint is not a valid code point.

if dst is null.

if dstIndex is negative, greater than or equal to dst.length or equals dst.length - 1 when codePoint is a IsSupplementaryCodePoint(Int32).

Remarks

Converts the specified character (Unicode code point) to its UTF-16 representation. If the specified code point is a BMP (Basic Multilingual Plane or Plane 0) value, the same value is stored in dst[dstIndex], and 1 is returned. If the specified code point is a supplementary character, its surrogate values are stored in dst[dstIndex] (high-surrogate) and dst[dstIndex+1] (low-surrogate), and 2 is returned.

Added in 1.5.

Java documentation for java.lang.Character.toChars(int, char[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ToChars(Int32)

Converts the specified character (Unicode code point) to its UTF-16 representation stored in a char array.

[Android.Runtime.Register("toChars", "(I)[C", "")]
public static char[]? ToChars (int codePoint);
[<Android.Runtime.Register("toChars", "(I)[C", "")>]
static member ToChars : int -> char[]

Parameters

codePoint
Int32

a Unicode code point

Returns

Char[]

a char array having codePoint's UTF-16 representation.

Attributes

Exceptions

if codePoint is not a valid code point.

Remarks

Converts the specified character (Unicode code point) to its UTF-16 representation stored in a char array. If the specified code point is a BMP (Basic Multilingual Plane or Plane 0) value, the resulting char array has the same value as codePoint. If the specified code point is a supplementary code point, the resulting char array has the corresponding surrogate pair.

Added in 1.5.

Java documentation for java.lang.Character.toChars(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to