aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Text.by_split.3
diff options
context:
space:
mode:
Diffstat (limited to 'man/man3/tomo-Text.by_split.3')
-rw-r--r--man/man3/tomo-Text.by_split.340
1 files changed, 40 insertions, 0 deletions
diff --git a/man/man3/tomo-Text.by_split.3 b/man/man3/tomo-Text.by_split.3
new file mode 100644
index 00000000..ad585f50
--- /dev/null
+++ b/man/man3/tomo-Text.by_split.3
@@ -0,0 +1,40 @@
+'\" t
+.\" Copyright (c) 2025 Bruce Hill
+.\" All rights reserved.
+.\"
+.TH Text.by_split 3 2025-04-19T14:30:40.367152 "Tomo man-pages"
+.SH NAME
+Text.by_split \- Returns an iterator function that can be used to iterate over text separated by a delimiter. **Note:** to split based on a set of delimiters, use [`by_split_any()`](#by_split_any).
+
+.SH LIBRARY
+Tomo Standard Library
+.SH SYNOPSIS
+.nf
+.BI "Text.by_split : func(text: Text, delimiter: Text = "" -> func(->Text?))"
+.fi
+
+.SH DESCRIPTION
+Returns an iterator function that can be used to iterate over text separated by a delimiter. **Note:** to split based on a set of delimiters, use [`by_split_any()`](#by_split_any).
+
+
+.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. -
+delimiter Text An exact delimiter to use for splitting the text. ""
+.TE
+.SH RETURN
+An iterator function that returns one chunk of text at a time, separated by the given delimiter, until it runs out and returns `none`. **Note:** using an empty delimiter (the default) will iterate over single grapheme clusters in the text.
+
+.SH NOTES
+If an empty text is given as the delimiter, then each split will be the graphical clusters of the text.
+
+.SH EXAMPLES
+.EX
+text := "one,two,three"
+for chunk in text.by_split(",")
+# Prints: "one" then "two" then "three":
+say(chunk)
+.EE