[Overview][Types][Classes][Procedures and functions][Variables][Index] |
Fast version of UTF8Length.
Source position: lazutf8.pas line 84
function UTF8LengthFast( |
const s: string |
):PtrInt; |
p: PChar; |
ByteCount: PtrInt |
):PtrInt; |
s |
|
String with UTF-8-encoded values. |
Number of codepoints in the string.
p |
|
Pointer to the String with UTF-8-encoded values. |
ByteCount |
|
Number of byte values in the UTF-8-encoded string. |
UTF8LengthFast is an overloaded PtrInt function used to get the length of a UTF-8-encoded string in codepoints. UTF8LengthFast is the fast version of UTF8Length. It does not call the UTF8CodepointSize function. The UTF-8-encoded string data is assumed to be valid. The native data size for the CPU is used to process blocks of UTF-8-encoded data. For a 64-bit CPU, this means that 8 bytes are read and processed at once.
The overloaded variants allow the UTF-8-encoded data to be specified as either a String type, or a null-terminated PChar type. Internally, the String-based variant casts its data to a PChar type and calls the overloaded variant.
UTF8LengthFast is a Free Pascal implementation of the C routine provided by Colin Percival:
Even faster UTF-8 character counting
|
Gets the length of a UTF-8-encoded string in codepoints. |
Version 3.2 | Generated 2024-02-25 | Home |