HomeManualTopicsTypesSymbols

std::split_into_indented_lines

splits a text into indented lines

Parameter

text
the string to process

Results

None

Description

The result is a list of tuples with two fields:

  • indent

  • text_line

    The text_line still contains the trailing line feed but leading whitespace is removed.

    If a line does not contain any text (whitespace does not count as text) then the whole tuple is replaced with the special value std::undefined.

    Example

    $text " a 1 2 3 b 4 5 $lines split_into_indented_lines(text) dump! 3 lines

    Output

    lines: list tuple 0 "a@0xa;" tuple 2 "1@0xa;" tuple 2 "2@0xa;" tuple 2 "3@0xa;" tuple 0 "b@0xa;" tuple 2 "4@0xa;" tuple 2 "5@0xa;"

    Topic

    Strings

    See also

    std::split_into_lines
    std::split_into_groups splits already indented lines into groups