asLineWrapped

Returns an InputRange (LineWrapRange) that will wrap the given text onto seperate lines.

  1. LineWrapRange!string asLineWrapped(string text, LineWrapOptions options)
  2. LineWrapRange!(const(char)[]) asLineWrapped(CharArrayT text, LineWrapOptions options)
    @safe pure
    LineWrapRange!(const(char)[])
    asLineWrapped
    (
    CharArrayT
    )
    if (
    is(CharArrayT == char[]) ||
    is(CharArrayT == const(char)[])
    )

Parameters

text CharArrayT

The text to line wrap.

options LineWrapOptions

The options to line wrap with, such as whether to add a prefix and suffix.

Return Value

Type: LineWrapRange!(const(char)[])

A LineWrapRange that will wrap the given text onto seperate lines.

Examples

auto constChars   = cast(const(char)[])"Hello";
auto mutableChars = ['H', 'e', 'l', 'l', 'o'];

// Mutable "char[]" is promoted to const "const(char)[]".
LineWrapRange!(const(char)[]) constRange   = constChars.asLineWrapped;
LineWrapRange!(const(char)[]) mutableRange = mutableChars.asLineWrapped;

See Also

LineWrapRange for full documentation.

lineWrap for an eagerly evaluated version.

Meta