Sign in Join
FPDoc Onlineexperiment

UTF8CStringToUTF8String function

In unit LazUTF8

Copies from a C-style string with UTF-8 encoding to UTF-8 string.

Declaration

pascal
function UTF8CStringToUTF8String(SourceStart: PChar; SourceLen: PtrInt)
: string

Description

UTF8CStringToUTF8String is a String function used to copy the specified number of characters (codepoints) from a C-style string with UTF-8 encoding. The return value is a UTF-encoded string with C-style specials characters converted to their common equivalents. The following C-style quoted characters are handled in the function:

\t
Converted to a Tab character (Decimal 9)
\"
Converted to a Double Quote character (Decimal 34)
\\
Converted to a Reverse Solidus character (Decimal 92)
\n
Converted to the LineEnding ending for the OS or platform

The return value is a string which contains the number of codepoints in SourceStart specified in SourceLen, or an empty string ('') when SourceLen is 0 (zero).

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