[Overview][Types][Classes][Procedures and functions][Variables][Index] |
Gets the length of a UTF-8-encoded string in codepoints.
Source position: lazutf8.pas line 81
function UTF8Length( |
const s: string |
):PtrInt; |
p: PChar; |
ByteCount: PtrInt |
):PtrInt; |
s |
|
UTF-8-encoded string to examine in the function. |
Number of codepoints in the byte values for the string.
p |
|
Pointer to the UTF-8-encoded string to examine in the function. |
ByteCount |
|
Number of byte values in the UTF-8-encoded string. |
UTF8Length is a function used to get the character length for the specified UTF-8-encoded string. The return value contains the number of UTF-8-encoded characters (or codepoints) found in the byte values for the string.
An overloaded variant of the function is provided which uses the PChar type to specify the byte values in the string. Internally, the String variant casts its value a PChar type and calls the overloaded variant.
UTF8Length iterates over the bytes in the UTF-8-encoded string data, and calls UTF8CodepointSize to determine the number of bytes needed for each codepoint. Use UTF8LengthFast for a version of the routine optimized for speed.
|
Returns the size of the UTF-8 codepoint in bytes. |
|
|
Fast version of UTF8Length. |
Version 3.2 | Generated 2024-02-25 | Home |