Sign in Join
FPDoc Onlineexperiment

CodePointSize function

In unit LazUnicode

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

Declaration

pascal
function CodePointSize(p: PChar): Integer

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.

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.