blob: a9f55c46eea33f5677d9590f846c5a7874e71f40 (
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
40
41
42
|
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Text.lines 3 2025-09-06 "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 lb
l l l l.
Name Type Description Default
text Text The text to be split into lines. -
.TE
.SH RETURN
A list of substrings resulting from the split.
.SH EXAMPLES
.EX
>> "one\[rs]ntwo\[rs]nthree".lines()
= ["one", "two", "three"]
>> "one\[rs]ntwo\[rs]nthree\[rs]n".lines()
= ["one", "two", "three"]
>> "one\[rs]ntwo\[rs]nthree\[rs]n\[rs]n".lines()
= ["one", "two", "three", ""]
>> "one\[rs]r\[rs]ntwo\[rs]r\[rs]nthree\[rs]r\[rs]n".lines()
= ["one", "two", "three"]
>> "".lines()
= []
.EE
|