[Overview][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'LazUTF8' (#lazutils)

UTF8CStringToUTF8String

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

Declaration

Source position: lazutf8.pas line 110

function UTF8CStringToUTF8String(

  SourceStart: PChar;

  SourceLen: PtrInt

):string;

Arguments

SourceStart

  

PChar with the UTF-8-encoded C-style string.

SourceLen

  

Number of codepoints to copy in the method.

Function result

UTF-8-encode string with C-style quoting removed.

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).


Version 3.2 Generated 2024-02-25 Home