UnicodeUtility.GetCharacterLength method (1 of 2)

Gets the length (in chars) of the Unicode character at the specified offset in the given string.

public static int GetCharacterLength(string s, int nIndex)
parameter description
s A String.
nIndex The character position in s.

Return Value

The number of chars (i.e., UTF-16 code units) it takes to encode the character.

See Also


UnicodeUtility.GetCharacterLength method (2 of 2)

Gets the length (in chars) of the Unicode character at the specified offset in the given StringBuilder.

public static int GetCharacterLength(StringBuilder sb, int nIndex)
parameter description
sb A StringBuilder.
nIndex The character position in sb.

Return Value

The number of chars (i.e., UTF-16 code units) it takes to encode the character.

See Also