main
Download
42 lines 1.2 KiBGroffModified 2026-03-09 raw
123456789101112131415161718192021222324252627282930313233343536373839404142
'\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Text.by_split_any 3 2026-03-08 "Tomo man-pages"
.SH NAME
Text.by_split_any \- iterate by one of many splitting characters
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Text.by_split_any\ :\ func(text:\ Text,\ delimiters:\ Text\ =\ "\ $\[rs]t\[rs]r\[rs]n"\ ->\ func(->Text?))
.fi
.SH DESCRIPTION
Returns an iterator function that can be used to iterate over text separated by one or more characters (grapheme clusters) from a given text of delimiters.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
text	Text	The text to be iterated over in delimited chunks. 	-
delimiters	Text	Grapheme clusters to use for splitting the text. 	"\ $\[rs]t\[rs]r\[rs]n"
.TE
.SH RETURN
An iterator function that returns one chunk of text at a time, separated by the given delimiter characters, until it runs out and returns `none`.

.SH NOTES
Splitting will occur on every place where one or more of the grapheme clusters in `delimiters` occurs.
To split based on an exact delimiter, use Text.by_split().

.SH EXAMPLES
.EX
text := "one,two,;,three"
chunks := [chunk for chunk in text.by_split_any(",;")]
assert chunks == ["one", "two", "three"]
.EE
.SH SEE ALSO
.BR Tomo-Text (3)