Sign in Join
FPDoc Onlineexperiment

UTF8Delete procedure

In unit LazUTF8

Deletes characters (or codepoints) in a UTF-8-encoded string.

Declaration

pascal
procedure UTF8Delete(var s: Utf8String; StartCharIndex: PtrInt; 
 CharCount: PtrInt)

Description

UTF8Delete is an overloaded procedure used to delete characters (or codepoints) in a UTF-8-encoded string starting at a given position.

StartCharIndex contains the character position in s where values will be removed. StartCharIndex refers to codepoints and not individual byte or character values. A single character can be expressed as 1-4 byte values in UTF-8 encoding. CharCount indicates the number of codepoints to remove in the function.

The value in s is updated directly in the function.

An overloaded variant of the procedure is provided for platforms where the Win1252 code page is used. On these platforms, raw byte values values in s are converted to the UTF-8 code page prior to performing the delete operation.

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