Method Format
Format(ustring, int, TextAlignment, bool, bool, int, TextDirection)
Reformats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
public static List<ustring> Format(ustring text, int width, TextAlignment talign, bool wordWrap, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom)
Parameters
text
ustringwidth
intThe width to bound the text to for word wrapping and clipping.
talign
TextAlignmentSpecifies how the text will be aligned horizontally.
wordWrap
boolIf
true
, the text will be wrapped to new lines as need. Iffalse
, forces text to fit a single line. Line breaks are converted to spaces. The text will be clipped towidth
preserveTrailingSpaces
boolIf
true
and 'wordWrap' also true, the wrapped text will keep the trailing spaces. Iffalse
, the trailing spaces will be trimmed.tabWidth
intThe tab width.
textDirection
TextDirectionThe text direction.
Returns
- List<ustring>
A list of word wrapped lines.
Remarks
An empty text
string will result in one empty line.
If width
is 0, a single, empty line will be returned.
If width
is int.MaxValue, the text will be formatted to the maximum width possible.
Format(ustring, int, bool, bool, bool, int, TextDirection)
Reformats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
public static List<ustring> Format(ustring text, int width, bool justify, bool wordWrap, bool preserveTrailingSpaces = false, int tabWidth = 0, TextDirection textDirection = TextDirection.LeftRight_TopBottom)
Parameters
text
ustringwidth
intThe width to bound the text to for word wrapping and clipping.
justify
boolSpecifies whether the text should be justified.
wordWrap
boolIf
true
, the text will be wrapped to new lines as need. Iffalse
, forces text to fit a single line. Line breaks are converted to spaces. The text will be clipped towidth
preserveTrailingSpaces
boolIf
true
and 'wordWrap' also true, the wrapped text will keep the trailing spaces. Iffalse
, the trailing spaces will be trimmed.tabWidth
intThe tab width.
textDirection
TextDirectionThe text direction.
Returns
- List<ustring>
A list of word wrapped lines.
Remarks
An empty text
string will result in one empty line.
If width
is 0, a single, empty line will be returned.
If width
is int.MaxValue, the text will be formatted to the maximum width possible.