(43 lines)
1 '\" t2 .\" Copyright (c) 2026 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Text.by_line 3 2026-03-08 "Tomo man-pages"6 .SH NAME7 Text.by_line \- iterate by line8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Text.by_line\ :\ func(text:\ Text\ ->\ func(->Text?))13 .fi14 .SH DESCRIPTION15 Returns an iterator function that can be used to iterate over the lines in a text.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx23 l l l.24 Name Type Description25 text Text The text to be iterated over, line by line.26 .TE27 .SH RETURN28 An iterator function that returns one line at a time, until it runs out and returns `none`.30 .SH NOTES31 This function ignores a trailing newline if there is one. If you don't want this behavior, use `text.by_split($/{1 nl}/)` instead.33 .SH EXAMPLES34 .EX35 text := "36 line one37 line two38 "39 lines := [line for line in text.by_line()]40 assert lines == ["line one", "line two"]41 .EE42 .SH SEE ALSO43 .BR Tomo-Text (3)