123456789101112131415161718192021222324252627282930313233343536373839 | '\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Text.lines 3 2025-11-29 "Tomo man-pages"
.SH NAME
Text.lines \- get list of lines
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Text.lines\ :\ func(text:\ Text\ ->\ [Text])
.fi
.SH DESCRIPTION
Splits the text into a list of lines of text, preserving blank lines, ignoring trailing newlines, and handling `\r\n` the same as `\n`.
.SH ARGUMENTS
.TS
allbox;
lb lb lbx
l l l.
Name Type Description
text Text The text to be split into lines.
.TE
.SH RETURN
A list of substrings resulting from the split.
.SH EXAMPLES
.EX
assert "one\[rs]ntwo\[rs]nthree".lines() == ["one", "two", "three"]
assert "one\[rs]ntwo\[rs]nthree\[rs]n".lines() == ["one", "two", "three"]
assert "one\[rs]ntwo\[rs]nthree\[rs]n\[rs]n".lines() == ["one", "two", "three", ""]
assert "one\[rs]r\[rs]ntwo\[rs]r\[rs]nthree\[rs]r\[rs]n".lines() == ["one", "two", "three"]
assert "".lines() == []
.EE
.SH SEE ALSO
.BR Tomo-Text (3)
|