Sign in Join
FPDoc Onlineexperiment

UTF8PadCenter function

In unit LazUTF8

Center aligns a string to the specified length.

Declaration

pascal
function UTF8PadCenter(const S: string; const N: Integer; 
 const AUtf8Char: string=#32): string

Arguments

S

Original string value.

N

Desired length for the string (in codepoints).

AUtf8Char

UTF-8 codepoint used as a padding character.

Function result

Modified value for the string after center alignment.

Description

UTF8PadCenter is used to center align a string to the specified length (number of codepoints). N indicates the length of the modified string after padding on the left and right with the UTF-8 codepoint in AUtf8Char. The default value for AUtf8Char is #32 ([SPACE]), but can contains any valid UTF-8 codepoint (1 to 4 bytes).

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.