diff options
Diffstat (limited to 'man/man3/tomo-Text.by_line.3')
| -rw-r--r-- | man/man3/tomo-Text.by_line.3 | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/man/man3/tomo-Text.by_line.3 b/man/man3/tomo-Text.by_line.3 new file mode 100644 index 00000000..a5066e66 --- /dev/null +++ b/man/man3/tomo-Text.by_line.3 @@ -0,0 +1,39 @@ +'\" t +.\" Copyright (c) 2025 Bruce Hill +.\" All rights reserved. +.\" +.TH Text.by_line 3 2025-04-19T14:30:40.367111 "Tomo man-pages" +.SH NAME +Text.by_line \- Returns an iterator function that can be used to iterate over the lines in a text. + +.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. + + +.TS +allbox; +lb lb lbx lb +l l l l. +Name Type Description Default +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`. **Note:** 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 +" +for line in text.by_line() +# Prints: "line one" then "line two": +say(line) +.EE |
