ComfyUI Node

trim String _O

A One-Line Node That Lives in a Dead Dialect

By omar92·Created 3 years ago·Updated 5 months ago· 181
trim String _O
  • string
  • STR

trim String _O strips the whitespace off both ends of a string. That's it. One input, one output, and behind the scenes it's a single Python .strip() call. It lives under O/deprecated/string/operations in omar92's Quality of Life Suit pack, and like its sibling String _O, it speaks the old STR dialect - so it's really only useful inside legacy workflows that still chain the deprecated string nodes together.

If you're setting up a fresh workflow and want to clean up text, grab trim_text _O from O/text/operations in the same pack instead. Same strip, but it takes and returns the standard STRING type, so it plugs straight into prompt boxes and text routes.

How it works

The deprecated string suite passes text around as STR - a custom socket type carrying a {"string": ...} dict rather than a plain Python string. trim String _O takes that dict, runs .strip() on the contents, and hands the trimmed dict back. Strip removes leading and trailing whitespace: spaces, tabs, newlines. It does not touch whitespace inside the string, and it doesn't do anything clever like collapsing repeated spaces - if you want that, this isn't the node.

The shape of the graph matters more than the mechanics. Because the output type is STR, this node only connects to the other old-style nodes - String _O in, replace String _O or Debug String _O out. Try to feed it into a CLIPTextEncode and the wire won't even try to attach; ComfyUI matches sockets by type name and STR isn't STRING. That's not a bug in your workflow, it's the pack's own versioning mess.

When you'd actually reach for it

Realistically, only two scenarios:

  • You loaded a workflow from 2023–2024 that still uses the old chain, and trimming is part of it. The node keeps the graph working without you editing anything.
  • You're working inside this pack's deprecated string pipeline for some other reason and need to normalize an input before passing it on.

For anything else, trim_text _O is strictly better: same .strip() behavior, standard types, zero legacy quirks. The only difference worth noting is cosmetic - the deprecated node's input is labeled string (type STR) while the current one calls its input text (type STRING).

Installing and quirks

It ships with the pack, so installing is one step:

cd ComfyUI/custom_nodes
git clone https://github.com/omar92/ComfyUI-QualityOfLifeSuit_Omar92.git

Restart ComfyUI afterward - a page reload doesn't cut it. ComfyUI Manager users can just search "Quality of Life Suit". No extra dependencies for this node; it's pure Python on top of what ComfyUI already provides. The pack creates a config.json on first run and self-updates from GitHub by default (setting "autoUpdate": false in that file disables it).

Two harmless startup messages you may see: QualityOfLifeSuit_Omar92::NSP ready (fine) and Error. No styles.csv found... (the NSP feature griping, unrelated to string ops). Neither affects this node.

The takeaway is short, like the node: if you found this via search, you probably want trim_text _O. This one exists so old graphs don't rot, and that's a fine reason to ship a node - just not a reason to build on it.

CategoryO/deprecated/string/operations

Inputs (1)

NameTypeDefaultDescription
stringSTR

Outputs (1)

NameTypeDescription
STRSTR