main
Download
43 lines 916 BGroffModified 2026-03-09 raw
12345678910111213141516171819202122232425262728293031323334353637383940414243
'\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Text.by_line 3 2026-03-08 "Tomo man-pages"
.SH NAME
Text.by_line \- iterate by line
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Text.by_line\ :\ func(text:\ Text\ ->\ func(->Text?))
.fi
.SH DESCRIPTION
Returns an iterator function that can be used to iterate over the lines in a text.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx
l l l.
Name	Type	Description
text	Text	The text to be iterated over, line by line. 
.TE
.SH RETURN
An iterator function that returns one line at a time, until it runs out and returns `none`.

.SH NOTES
This function ignores a trailing newline if there is one. If you don't want this behavior, use `text.by_split($/{1 nl}/)` instead.

.SH EXAMPLES
.EX
text := "
    line one
    line two
"
lines := [line for line in text.by_line()]
assert lines == ["line one", "line two"]
.EE
.SH SEE ALSO
.BR Tomo-Text (3)