Text String Truncate
Chop a string down to size, from either end
- TEXT
- TEXT_B
- TEXT_C
- TEXT_D
- TEXT_E
- TEXT_F
- TEXT_G
- TEXT_H
- TEXT_I
- TEXT_J
- TEXT_K
- TEXT_L
- TEXT_M
- TEXT_N
- TEXT_O
- TEXT_P
- TEXT_Q
- TEXT_R
- TEXT_S
- TEXT_T
- TEXT_U
- TEXT_V
- TEXT_W
- TEXT_X
Exactly what it says: it truncates a string, from the beginning or the end, by characters or by words. Nothing fancier than that, and that's the appeal - half the time you don't need clever text processing, you need to make sure a string doesn't blow past a length limit somewhere downstream.
Where it actually earns its slot
The obvious use is filenames. If you're building a save filename out of a truncated prompt or a caption, most filesystems (and your own sanity when browsing an output folder) start to hurt somewhere past a couple hundred characters. Feed your full prompt or a BLIP-generated caption through this node, cap it at a sane length, and hand the result to WAS's Save Text File or Save Image filename pattern instead of the raw string.
The other case is anywhere a downstream node or model has an effective input limit - a CLIP text encoder's token budget, a caption overlay that only has room for one line, a title field in some other tool your workflow feeds into. Rather than manually keeping your prompt short, you write it long and let this node cut it down automatically before it reaches the limit.
How it works
You give it a string, and it cuts from either the front or the back, counting either in characters or in whole words. Character truncation is the blunt option - fast and predictable, but it can land you mid-word. Word truncation costs a little more precision over the exact length but keeps what's left readable, which matters if the truncated text is going to be displayed rather than just used as an internal identifier. The output is a single truncated string, and it slots in anywhere a text input goes - another Text Concatenate, a Save node, a second Truncate node if you need to cut from both ends.
Installing it
This is one node out of the whole WAS Node Suite pack - you don't install it separately:
- ComfyUI Manager - search WAS Node Suite, install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/WASasquatch/was-node-suite-comfyui/, thenpip install -r requirements.txtfrom inside that folder (or the portable build's embedded python equivalent), then restart ComfyUI.
Common issues
Nothing specific to this node tends to go wrong beyond the obvious: truncating by character can slice a word in half, which looks sloppy in a filename or a displayed caption - switch to word-based truncation if that's a problem for you, at the cost of the exact length no longer being guaranteed.
The pack-wide issue to know about going in: WAS Node Suite hasn't been actively developed since December 2023, and the most common symptom of that is an "Import Failed" error after a ComfyUI update, because the pack's pinned dependencies can drift out of sync with what a newer ComfyUI or a sibling custom node expects. If that happens, reinstalling requirements.txt inside your ComfyUI venv is usually the fix; it's a real, recurring complaint in the community, not a one-off.
Inputs (27)
| Name | Type | Default | Description |
|---|---|---|---|
| truncate_by | COMBO | What truncate_to counts. `characters` counts single characters, spaces included. `words` counts whitespace-separated words and rejoins them with one space each, so line breaks and runs of spaces in the text collapse. | |
| truncate_from | COMBO | Which end of the text is kept. `end` keeps the tail and throws the start away, so 'a long prompt' truncated to 6 characters becomes 'prompt'. `beginning` keeps the head, giving 'a long'. | |
| truncate_to | INT | 10-99999999–99999999 | How much to keep, counted in characters or words. A negative value measures what to remove instead: with truncate_from `end`, -10 keeps everything except the last 10, and with `beginning`, -10 keeps only the last 10. Zero with `end` keeps everything, and zero with `beginning` empties the text. |
| text | STRING | First text to shorten; STRING. Cut per truncate_by, truncate_from and truncate_to; leaves on TEXT. | |
| text_bopt | STRING | Second text; STRING. Same settings, leaves on TEXT_B. | |
| text_copt | STRING | Third text; STRING. Same settings, leaves on TEXT_C. | |
| text_dopt | STRING | Fourth text; STRING. Same settings, leaves on TEXT_D. | |
| text_eopt | STRING | Text 5, emitted on its own output. Tokens are substituted. | |
| text_fopt | STRING | Text 6, emitted on its own output. Tokens are substituted. | |
| text_gopt | STRING | Text 7, emitted on its own output. Tokens are substituted. | |
| text_hopt | STRING | Text 8, emitted on its own output. Tokens are substituted. | |
| text_iopt | STRING | Text 9, emitted on its own output. Tokens are substituted. | |
| text_jopt | STRING | Text 10, emitted on its own output. Tokens are substituted. | |
| text_kopt | STRING | Text 11, emitted on its own output. Tokens are substituted. | |
| text_lopt | STRING | Text 12, emitted on its own output. Tokens are substituted. | |
| text_mopt | STRING | Text 13, emitted on its own output. Tokens are substituted. | |
| text_nopt | STRING | Text 14, emitted on its own output. Tokens are substituted. | |
| text_oopt | STRING | Text 15, emitted on its own output. Tokens are substituted. | |
| text_popt | STRING | Text 16, emitted on its own output. Tokens are substituted. | |
| text_qopt | STRING | Text 17, emitted on its own output. Tokens are substituted. | |
| text_ropt | STRING | Text 18, emitted on its own output. Tokens are substituted. | |
| text_sopt | STRING | Text 19, emitted on its own output. Tokens are substituted. | |
| text_topt | STRING | Text 20, emitted on its own output. Tokens are substituted. | |
| text_uopt | STRING | Text 21, emitted on its own output. Tokens are substituted. | |
| text_vopt | STRING | Text 22, emitted on its own output. Tokens are substituted. | |
| text_wopt | STRING | Text 23, emitted on its own output. Tokens are substituted. | |
| text_xopt | STRING | Text 24, emitted on its own output. Tokens are substituted. |
Outputs (24)
| Name | Type | Description |
|---|---|---|
| TEXT | STRING | The shortened text. |
| TEXT_B | STRING | The shortened text_b. |
| TEXT_C | STRING | The shortened text_c. |
| TEXT_D | STRING | The shortened text_d. |
| TEXT_E | STRING | Text 5, with its tokens substituted. |
| TEXT_F | STRING | Text 6, with its tokens substituted. |
| TEXT_G | STRING | Text 7, with its tokens substituted. |
| TEXT_H | STRING | Text 8, with its tokens substituted. |
| TEXT_I | STRING | Text 9, with its tokens substituted. |
| TEXT_J | STRING | Text 10, with its tokens substituted. |
| TEXT_K | STRING | Text 11, with its tokens substituted. |
| TEXT_L | STRING | Text 12, with its tokens substituted. |
| TEXT_M | STRING | Text 13, with its tokens substituted. |
| TEXT_N | STRING | Text 14, with its tokens substituted. |
| TEXT_O | STRING | Text 15, with its tokens substituted. |
| TEXT_P | STRING | Text 16, with its tokens substituted. |
| TEXT_Q | STRING | Text 17, with its tokens substituted. |
| TEXT_R | STRING | Text 18, with its tokens substituted. |
| TEXT_S | STRING | Text 19, with its tokens substituted. |
| TEXT_T | STRING | Text 20, with its tokens substituted. |
| TEXT_U | STRING | Text 21, with its tokens substituted. |
| TEXT_V | STRING | Text 22, with its tokens substituted. |
| TEXT_W | STRING | Text 23, with its tokens substituted. |
| TEXT_X | STRING | Text 24, with its tokens substituted. |