text_text_splitter
Split text into an array using line, word, character, delimiter, or regex methods. Optionally trim parts, drop empty entries, and limit splits.
Instructions
Text Splitter. Split one string into an array of parts using a chosen method: by lines, by words (whitespace runs), by individual characters, by a literal delimiter, or by a regular expression. Optionally trim each part, drop empty parts, and cap the number of splits. Use this to break a string apart; use text_joiner for the inverse (merging items into one string), text_statistics for whole-text metrics without splitting, and column_tool for aligning delimited tabular data. Pure local compute: read-only, non-destructive, offline, deterministic, and rate-limited (60 requests/min for anonymous callers). Returns the parts array plus original/result length statistics and the effective settings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to split. Required and must be non-empty; a blank value returns a 400 error. | |
| splitType | No | Split method. lines splits on newlines; words on whitespace runs; characters into single chars; delimiter on the literal delimiter value; regex on the regex pattern. | lines |
| delimiter | No | Literal delimiter used only when splitType is delimiter; an empty string returns the text unsplit. | , |
| regex | No | Pattern used only when splitType is regex; accepts a bare pattern or PHP-style /pattern/flags; an empty string returns the text unsplit. | |
| removeEmpty | No | Drop empty parts after splitting (for characters mode, also drops spaces). | |
| trimElements | No | Trim leading/trailing whitespace from each part (ignored for characters mode). | |
| maxSplits | No | Maximum number of splits for delimiter/regex modes; 0 means no limit. Ignored for lines/words/characters. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Always true on success. | |
| result | No | The resulting parts after splitting and applying remove-empty/trim options. | |
| stats | No | Metrics for the original text and the result. | |
| options | No | The effective options echoed in camelCase. |