text_text_trimmer
Trim whitespace and custom characters from each line of text. Options include leading, trailing, both, or all occurrences, with support for preserving indentation and dropping empty lines.
Instructions
Text Trimmer (Whitespace & Character Cleanup). Trim and clean text by removing whitespace or custom characters from each line, with options to strip leading/trailing/all-occurrence characters, drop blank lines, and preserve indentation. Use it to normalize whitespace and tidy formatting; use text_find_replace for pattern-based edits and text_duplicate_line_remover to dedupe lines. Runs locally on the text you provide: read-only, non-destructive, contacts no external service, and is rate-limited (60 requests/min anonymous). Returns the trimmed text plus before/after statistics and a count of characters, spaces, lines, and empty lines removed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to trim. Processed line by line, split on newlines. | |
| trimType | No | Where to trim on each line. both trims both ends (right-only when preserveIndentation is true); left/leading trims the start; right/trailing trims the end; all removes every occurrence of the trim characters anywhere in the line. | both |
| trimWhitespace | No | Include standard whitespace (space, tab, newline, CR, null, vtab) in the trim set. | |
| trimEmptyLines | No | Also drop lines that are empty or whitespace-only. | |
| customCharacters | No | Extra characters to trim, added to the whitespace set. If set and trimWhitespace is false, only these characters are trimmed. | |
| preserveIndentation | No | Keep leading indentation; for both/left trim types only trailing whitespace is affected. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Whether trimming succeeded. | |
| result | No | The trimmed output text. | |
| stats | No | Before/after statistics and change counts. | |
| options | No | Echo of the effective options used. |