Unit 'Character' Package
[Overview][Types][Classes][Procedures and functions][Index] [#rtl]

TCharacter.ConvertToUtf32

Convert a UTF16 character to a UTF32 character.

Declaration

Source position: character.pas line 104

public class function TCharacter.ConvertToUtf32(

  const AString: UnicodeString;

  AIndex: Integer

):UCS4Char; overload;

class function TCharacter.ConvertToUtf32(

  const AString: UnicodeString;

  AIndex: Integer;

  out ACharLength: Integer

):UCS4Char; overload;

class function TCharacter.ConvertToUtf32(

  const AHighSurrogate: UnicodeChar;

  const ALowSurrogate: UnicodeChar

):UCS4Char; overload;

Arguments

AString

  

String containing the character to encode.

AIndex

  

Index at which the character to encode is located.

Function result

The Unicode character in UTF32 format.

Arguments

AString

  

String containing the character to encode.

AIndex

  

Index at which the character to encode is located.

ACharLength

  

Character length (in UTF16 characters).

Arguments

AHighSurrogate

  

The high pair of the surrogate.

ALowSurrogate

  

The low pair of the surrogate.

Description

TCharacter.ConvertToUtf32 converts a UTF16-encoded Unicode character to a Unicode32 character. This is the opposite of TCharacter.ConvertFromUtf32. The function exists in several overloaded versions, to be able to present the Unicode character in one of 2 ways:

  1. As a position AIndex (in unicodechar units) in a string AString to a Unicode32 character. The source is a string, since multiple UTF16 characters can be needed to encode a single UTF32 character. In this form, Optionally, the character length (1 or 2) can be returned in ACharLength.
  2. As 2 UTF16 Unicode characters, representing the high and low surrogate pairs: AHighSurrogate and ALowSurrogate.

Errors

If AIndex is not a valid character index in the string AString, an EArgumentOutOfRangeException exception is raised. If the character at that position is not complete, an EArgumentException exception is raised.

See also

TCharacter.ConvertFromUtf32

  

Convert a UTF32 character to UnicodeString.

EArgumentOutOfRangeException

  

Argument out of valid range passed to a function.

EArgumentException

  

Invalid argument passed to a function.


Documentation generated on: Nov 23 2024