Sign in Join
FPDoc Onlineexperiment

UTF8ProperCase function

In unit LazUTF8

Capitalizes the first letter of each word in the UTF-8-encoded string.

Declaration

pascal
function UTF8ProperCase(AInStr: string; const WordDelims: TSysCharSet)
: string

Description

UTF8ProperCase is a String function used to capitalize the first letter of each word in the specified string.

AInStr contains the UTF-8-encoded byte values examined and converted in the function. All of the values in AInStr are converted to lowercase using UTF8LowerCase prior to converting the case for codepoints.

WordDelims is the TSysCharSet set type which contains the system characters used as word delimiters in the conversion. Each occurrence of a character in WordDelims signals that the following codepoint should be converted to Uppercase.

UTF8ProperCase processes individual codepoints to get the return value for the function. It ensures that codepoints which have a different number of bytes in the lowercase and uppercase variants are handled properly. UTF8UpperCase is called to change the case for each codepoint following a word delimiter.

If AInStr is an empty string (''), the return value is also an empty string.

See also

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