blob: 7c53ed54241be1d977e545ee37ce510613f10a8e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
'\" 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)
|