'\" t .\" Copyright (c) 2025 Bruce Hill .\" All rights reserved. .\" .TH Text.by_line 3 2025-11-29 "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 " for line in text.by_line() # Prints: "line one" then "line two": say(line) .EE .SH SEE ALSO .BR Tomo-Text (3)