[Overview][Classes][Procedures and functions][Index] Reference for unit 'LazUnicode' (#lazutils)

CodePointSize

Gets the number of bytes needed for a CodePoint in the specified value.

Declaration

Source position: lazunicode.pas line 47

function CodePointSize(

  p: PChar

):Integer;

Arguments

p

  

String with the codepoint to examine in the function.

Function result

Number of bytes required for a codepoint.

Description

Gets the number of bytes needed for the CodePoint specified in p. For platforms that require UTF-16, TCharacter.IsHighSurrogate is called to get the return value. For other platforms, UTF8CodepointSizeFast is called to get the number of bytes for the codepoint. The return value is 1 or 2 for UTF-16-enabled platforms, or in the range 1..4 for UTF-8-enabled platforms. The return value can be 0 (zero) if p contains an empty string ('') or a malformed codepoint.


Version 4.0 Generated 2025-05-03 Home