blob: 7ac8a87d060c0e96a767e3415f9d084a7e4665e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Text.by_split_any 3 2025-04-19T14:48:15.716889 "Tomo man-pages"
.SH NAME
Text.by_split_any \- 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 LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Text.by_split_any\ :\ func(text:\ Text,\ delimiters:\ Text\ =\ "\ $\\t\\r\\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.
.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. "\ $\\t\\r\\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"
for chunk in text.by_split_any(",;")
# Prints: "one" then "two" then "three":
say(chunk)
.EE
|