LineWrapOptions.charsPerLine

Calculates the amount of characters per line that can be used for the user's provided text.

In other words, how many characters are left after the linePrefix, lineSuffix, and any additionalChars are considered for.

struct LineWrapOptions
@safe @nogc nothrow pure const
size_t
charsPerLine
(
size_t additionalChars = 0
)

Parameters

additionalChars size_t

The amount of additional chars that are outputted with every line, e.g. if you want to add new lines or tabs or whatever.

Return Value

Type: size_t

The amount of characters per line, not including "static" characters such as the linePrefix and so on.

0 is returned on underflow.

Examples

assert(LineWrapOptions(120).charsPerLine               == 120);
assert(LineWrapOptions(120).charsPerLine(20)           == 100);
assert(LineWrapOptions(120, "ABC", "123").charsPerLine == 114);
assert(LineWrapOptions(120).charsPerLine(200)          == 0); // Underflow

Meta