SomethingToString_clh
Turn any value into text
- input
- STRING
ComfyUI is fussy about types. A socket that wants a string won't take an INT, a FLOAT won't drop into a text field, and you end up stuck with a number you need to say rather than compute with - put a seed into a filename, stamp a step count into a label, fold a computed value into a prompt. This node is the universal adapter: feed it anything, get a string back. Its own description is exactly that blunt - "converts any type to a string."
It's small, but it's the kind of glue node that quietly unblocks a workflow. When you're staring at a red "type mismatch" wire, this is often the fix.
How it works
The input is typed * - the wildcard that accepts any connection. Whatever you plug in, an integer, a float, some other value, the node coerces it to its string form and outputs that. On top of the raw conversion it gives you an optional prefix and suffix, so you can wrap the value while you're at it: turn a seed 12345 into seed_12345 or a step count 30 into 30 steps in the same node, no separate concatenation needed.
That combination - cast plus wrap - is what makes it more than a bare type-cast. It's a mini string-builder for the common "number into text" case.
The inputs and outputs that matter
input(required, wildcard*) - the value to convert. Wire in an INT, a FLOAT, whatever you've got that needs to become text.prefix(optional) - text glued to the front of the result.suffix(optional) - text glued to the end.
Output is a single STRING. Wire it wherever text is required - a filename prefix on a save node, a label, a segment of a prompt, an input to JoinStringMulti clh for further assembly.
Installing it
ComfyUI Manager: search Clh Tool for ComfyUI, install, restart. Or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/clhui/ComfyUi-clh-Tool
and restart ComfyUI. If a manual clone doesn't show the node, the startup console will name any missing dependency to pip install - Manager runs that step for you, a bare clone doesn't.
Common issues
Mostly this node just works, but a couple of things are worth knowing. Float formatting can surprise you - a value that's conceptually 0.5 might stringify as 0.5 or with trailing digits depending on how it arrives, and if you're building a filename you may not want a . in it. Check the actual output (park a Show Text clh next to it) before you rely on the exact format.
Second, remember it's a one-way conversion: string out, and there's no getting the original typed value back through this node. Use it at the point where you genuinely need text, not as a general pipe. And if what you actually wanted was to compute with the number rather than display it, this is the wrong tool - you want Math Expression clh for arithmetic, and SomethingToString only for the final "now make it text" step. Kept in that lane, it's the reliable little adapter that makes numbers and text play nicely.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| input | * | — | |
| prefixopt | STRING | — | |
| suffixopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |