Number To String
When a number stops being a number
- number
- result
UC_NumberToString does exactly what it says: takes an int or a float and hands you back its text form. That sounds like a solution in search of a problem until you hit the wall every ComfyUI user eventually hits - a node downstream that only accepts a string, and a number upstream that refuses to become one. This is the bridge.
It's part of the math/text cluster in silveroxides/ComfyUI-UtilsCollection, the big utility pack by silveroxides, and it replaced the equivalent node from the old standalone ComfyUI-LogicMath pack. Like everything in that cluster it's dependency-light and does one thing.
Where you actually use it
The classic use is assembling text. You've got a seed, a step count, or a CFG value floating around as a number, and you want to embed it into a string - a dynamic prompt, a filename, a custom text block that gets passed to a text-generation or overlay node. ComfyUI's string nodes don't generally accept raw numbers, so you route your value through this node first, then concatenate. It's also the clean inverse of the pack's UC_StringToNumber, which goes the other direction and even gives you a default value when the parse fails.
The number side is match-type, so ints and floats both come in fine. And the conversion is just Python's plain str() - no rounding, no thousand-separators, no scientific-notation surprises on ordinary values. What you see is what you get.
What's on the node
- number - the input. Match-type, int or float.
- result - a
STRINGoutput.
That's the whole node: one input, one output, no settings to misconfigure. The reason to keep it installed isn't that it's impressive; it's that string-building in ComfyUI is fiddly enough that a dedicated conversion node saves you a detour through a script node every single time you need it.
Installing it
It ships in the pack, not standalone:
- ComfyUI Manager: search "ComfyUI-UtilsCollection".
- Or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
Restart ComfyUI. Requirements are just opencv-python and typing-extensions. If you have ComfyUI-LogicMath installed, ComfyUI will offer to swap the old math nodes for these when you load old workflows - accept and remove the old pack.
Gotchas
Honestly, not much to trip over. The one behavior worth knowing: floats convert with full precision, so 1.5 becomes "1.5" and not "1.500000", and an int stays an int. If you need a float forced into "2.0" format for some downstream parser, this node won't pad it for you - that's a case for string formatting elsewhere. For everything else, it's the boring, dependable conversion node you'll reach for more than you expect.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| number | COMFY_MATCHTYPE_V3 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | STRING | — |