Sign in Join
FPDoc Onlineexperiment

UTF8FindNearestCharStart function

In unit LazUTF8

Finds the start of the UTF-8 character at the specified position.

Declaration

pascal
function UTF8FindNearestCharStart(UTF8Str: PChar; Len: SizeInt; 
 BytePos: SizeInt): SizeInt

Arguments

UTF8Str

Values to examine in the function.

Len

Length of the input values.

BytePos

Offset into UTF8Str for the initial byte value.

Function result

Position where the next codepoint begins.

Description

Find the start of the UTF-8 character which contains BytePos. If BytePos is not part of a valid UTF-8 Codepoint the function returns BytePos. BytePos values starts at position 0.

Len is the length in bytes.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.