aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Text.lines.3
blob: 0e93fc424a7d2b5aa656392d95d41a4296ed41f8 (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-04-19T14:48:15.717444 "Tomo man-pages"
.SH NAME
Text.lines \- 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 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`.


.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\\ntwo\\nthree".lines()
= ["one", "two", "three"]
>> "one\\ntwo\\nthree\\n".lines()
= ["one", "two", "three"]
>> "one\\ntwo\\nthree\\n\\n".lines()
= ["one", "two", "three", ""]
>> "one\\r\\ntwo\\r\\nthree\\r\\n".lines()
= ["one", "two", "three"]
>> "".lines()
= []
.EE