Split Text
Uncontrolled node
Overview
The Split Text node divides a string into an array of substrings based on a specified delimiter. This is useful for parsing comma-separated values, splitting sentences into words, or breaking down text by any custom pattern.
By default, if no separator is provided, the node splits the text by spaces. If the input text is not a valid string, the node returns an empty list.
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| Text | Text | The string to be split into parts. | - |
| Separator | Text | The delimiter character or pattern to split the text by. If left empty, defaults to a single space. | (space) |
Outputs
| Output | Type | Description |
|---|---|---|
| List | List | An array of strings containing the split parts of the input text. |
Runtime Behavior and Defaults
- Uncontrolled Node: This node runs automatically whenever its inputs change and does not require an event trigger.
- Default Separator: If the separator input is empty or not provided, the node uses a single space (
' ') as the delimiter. - Type Safety: If the input text is not a string, the node returns an empty list (
[]) rather than throwing an error. - Empty Strings: If the separator is not found in the text, the output list will contain the original text as a single element.
Example Usage
Splitting a comma-separated list:
- Text:
"apple,banana,cherry" - Separator:
"," - Output List:
["apple", "banana", "cherry"]
Splitting by spaces (default behavior):
- Text:
"Hello world from Intellectible" - Separator: (left empty)
- Output List:
["Hello", "world", "from", "Intellectible"]
Splitting by a custom pattern:
- Text:
"2024-12-25" - Separator:
"-" - Output List:
["2024", "12", "25"]