Method Format | Terminal.Gui v2 (original) (raw)

Namespace

Terminal.Gui

Assembly

Terminal.Gui.dll

Format()

Returns

string

The formatted text.

Format(string, int, Alignment, bool, bool, int, TextDirection, bool, TextFormatter?)

Formats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.

public static List<string> Format(string text, int width, Alignment textAlignment, bool wordWrap, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom, bool multiLine = false, TextFormatter? textFormatter = null)

Parameters

text string

width int

The number of columns to constrain the text to for word wrapping and clipping.

textAlignment Alignment

Specifies how the text will be aligned horizontally.

wordWrap bool

If true, the text will be wrapped to new lines no longer thanwidth. If false, forces text to fit a single line. Line breaks are converted to spaces. The text will be clipped to width.

preserveTrailingSpaces bool

If true trailing spaces at the end of wrapped lines will be preserved. If false , trailing spaces at the end of wrapped lines will be trimmed.

tabWidth int

The number of columns used for a tab.

textDirection TextDirection

The text direction.

multiLine bool

If true new lines are allowed.

textFormatter TextFormatter

TextFormatter instance to access any of his objects.

Returns

List<string>

A list of word wrapped lines.

Format(string, int, bool, bool, bool, int, TextDirection, bool, TextFormatter?)

Formats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.

public static List<string> Format(string text, int width, bool justify, bool wordWrap, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom, bool multiLine = false, TextFormatter? textFormatter = null)

Parameters

text string

width int

The number of columns to constrain the text to for word wrapping and clipping.

justify bool

Specifies whether the text should be justified.

wordWrap bool

If true, the text will be wrapped to new lines no longer thanwidth. If false, forces text to fit a single line. Line breaks are converted to spaces. The text will be clipped to width.

preserveTrailingSpaces bool

If true trailing spaces at the end of wrapped lines will be preserved. If false , trailing spaces at the end of wrapped lines will be trimmed.

tabWidth int

The number of columns used for a tab.

textDirection TextDirection

The text direction.

multiLine bool

If true new lines are allowed.

textFormatter TextFormatter

TextFormatter instance to access any of his objects.

Returns

List<string>

A list of word wrapped lines.