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

UTF8WrapText

Creates a word-wrapped version of the specified string.

Declaration

Source position: lazutf8.pas line 157

function UTF8WrapText(

  S: string;

  BreakStr: string;

  BreakChars: TSysCharSet;

  MaxCol: Integer;

  Indent: Integer

):string; overload;

function UTF8WrapText(

  S: string;

  BreakStr: string;

  BreakChars: TSysCharSet;

  MaxCol: Integer

):string; overload;

function UTF8WrapText(

  S: string;

  MaxCol: Integer

):string; overload;

Arguments

S

  

String with values word-wrapped in the routine.

BreakStr

  

End-of-line sequence used in the routine.

BreakChars

  

Set of characters where a line break cab be inserted.

MaxCol

  

Maximum line width in number of UTF-8 characters.

Indent

  

Number of Space (#32) characters used to indent the individual lines of word-wrapped text.

Function result

Word-wrapped version of the specified text.

Arguments

S

  

String with values word-wrapped in the routine.

BreakStr

  

End-of-line sequence used in the routine.

BreakChars

  

Set of characters where a line break cab be inserted.

MaxCol

  

Maximum line width in number of UTF-8 characters.

Arguments

S

  

String with values word-wrapped in the routine.

MaxCol

  

Maximum line width in number of UTF-8 characters.

Description

UTF8WrapText is an overloaded String function used to wrap lines of text in S at the number of characters (codepoints) specified in MaxCol.

The overloaded variant allow additional parameters to be provided with the EOL character sequence and a set of characters where a line break can be inserted. Default characters are used in BreakChars for the variant without a BreakChars argument. They include: ' ' (Space), '-' (Dash), and #9 (Tab). BreakStr contains the end-of-line sequence used to represent a line break inserted into the return value.

Use Indent to specify the number of Space (#32) characters inserted as indentation at the beginning of each word-wrapped line. The default value is 0 (zero) and omits indentation in the word-wrapped lines. A negative value in Indent causes the argument to be set to 0.

The Indent argument affects the number of UTF-8 characters allowed in each word-wrapped line. When set to a positive non-zero value, the maximum number of characters allowed per line is MaxCol - Indent.

No actions are performed in the function when S is an empty string (''), MaxCol is set to 0 (zero), or BreakChars is an empty set ([]).

Version info

Modified in LazUtils 4.0 to include the overload with an indentation argument.

See also

BreakString

  

Applies line breaks and indenting to a string value.


Version 4.0 Generated 2025-05-03 Home