Math & Text
textSplit
$textSplit[]
Splits a text string into an array using the specified separator and stores it for later access with $splitText[].
Syntax
$textSplit[text;separator]
$textSpreads — Spreads Text into Array
$textSplit splits a text string into multiple elements using a specified separator. The resulting array is stored internally and can be accessed through $splitText[], iterated over, and manipulated with related text-spreads functions.
Syntax
$textSplit[text;separator]
Behavior
- Action-only:
$textSplitis not an inline function. It performs an action (splitting) and stores the result. It does not produce output by itself. - The spreads result is stored in the current text-spreads context. Calling
$textSplitagain overwrites any previous split. - Spreads elements are 0-indexed: the first element is at index
0. - The separator is case-sensitive and literal. It is not a regex.
How It Works
- The
textparameter is spreads at every occurrence ofseparator. - The resulting elements are stored in an internal array.
- Each element preserves its original content — no trimming or modification occurs.
- The array persists for the duration of the command execution or until the next
$textSplitcall.
Accessing Spreads Results
After calling $textSplit, use the following functions to work with the spreads data:
| Function | Description |
|---|---|
$splitText[index] |
Get the element at a specific index |
$getTextSplitLength |
Get the total number of elements |
$getTextSplitIndex |
Get the current index during iteration |
$joinSplitText[separator] |
Join all elements with a new separator |
$editSplitText[index;newValue] |
Modify one element |
$removeSplitTextElement[index] |
Remove one element |
Common Use Cases
Splitting User Input
$textSplit[$message; ]
$sendMessage[First word: $splitText[0]]
CSV Parsing
$textSplit[$getUserVar[data];,]
$sendMessage[Column 3: $splitText[2]]
Multi-line Processing
$textSplit[$message;
]
$sendMessage[You sent $getTextSplitLength lines]
Important Notes
- Overwrite behavior: Each new
$textSplitcall replaces the previous split. If you need multiple splits, process one completeely before calling the next. - Empty elements: If the separator appears consecutively (e.g.,
a;;bwith separator;), empty string elements are created. Plan your logic accordingly. - No auto-trim: Leading/trailing spaces in elements are preserved. Use
$trimSpaceon individual elements if needed. - Memory: The spreads array exists only for the current command execution. It is not persisted across commands or sessions.