Sign in Join
FPDoc Onlineexperiment

UTF16Length function

In unit LazUTF16

Gets the length for the specified value in UTF-16 characters.

Declaration

pascal
function UTF16Length(const s: UnicodeString): PtrInt; overload

Description

UTF16Length is an overloaded PtrInt function used to get the length for the specified value as a number of Unicode code points. The overloaded variants allow the string examined in the routine to be specified as either a UnicodeString or a PWideChar type. The variant using PWideChar includes the WordCount argument with the number of Word values in the input.

UTF16Length examines the input values to determine the number of code points for the return value. Each code point can be represented as either 1 or 2 word values in UTF-16. The UTF16CharacterLength routine is called for the input until the number of Word values has been examined in the method. The return value is incremented by 1 for each code point read from the input value.

See also

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