[Overview][Types][Classes][Procedures and functions][Variables][Index] |
Tries to find the start of a valid UTF-8 codepoint in a string.
Source position: lazutf8.pas line 98
function Utf8TryFindCodepointStart( |
AString: PChar; |
var CurPos: PChar; |
out CodepointLen: Integer |
):Boolean; |
const AString: string; |
var Index: Integer; |
out CharLen: Integer |
):Boolean; |
AString |
|
Pointer to the string to examine in the function. |
CurPos |
|
Pointer to the first position in the string examined in the function. |
CodepointLen |
|
Number of bytes in the codepoint, or 0 when invalid. |
True when the bytes at the specified position are a valid UTF-8 codepoint.
AString |
|
Pointer to the string to examine in the function. |
Index |
|
Initial position in the string examined in the function. |
CharLen |
|
Number of bytes required for the UTF-8 codepoint. |
Utf8TryFindCodepointStart is a Boolean function which tries to find the start of a valid UTF-8 codepoint at the specified position in AString.
The return value contains True if the bytes at the specified position are a valid UTF-8 codepoint (1 - 4 bytes). When the return value is True, the value in CurPos is updated to contain the position in AString where the UTF-8 codepoint begins. Otherwise, the value in CurPos is unchanged. Please note, when CurPos points beyond the end of AString you will get a crash!
Remark: | UTF8CodepointStrictSize will NOT "look" beyond the terminating #0 in a PChar, so this is safe with AnsiString values. |
Version 3.2 | Generated 2024-02-25 | Home |