Sign in Join
FPDoc Onlineexperiment

UTF8CodepointToByteIndex function

In unit LazUTF8

Finds the byte index of the n-th UTF-8 codepoint.

Declaration

pascal
function UTF8CodepointToByteIndex(UTF8Str: PChar; Len: PtrInt; 
 CodepointIndex: PtrInt): PtrInt

Description

UTF8CodepointToByteIndex is a PtrInt function used to find the byte index in UTF8Str where the n-th UTF-8 codepoint is located. It calls UTF8CodepointStart to get a pointer to the requested codepoint position.

The return value contains the difference between the pointer offsets in each of the PChar values. The return value is -1 when a codepoint is not found at the specified position.

UTF8CodepointToByteIndex ignores BIDI mode.

See also

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