Nodes/quadmoon's ComfyUI nodes/Convert Number to String
ComfyUI Node

Convert Number to String

The One Size-Fits-All Number-to-Text Converter

By traugdor·Created 3 years ago·Updated 9 months ago· 16
Convert Number to String
    • STRING
    number_input

    The pack has separate converters for ints, floats, and booleans. This is the one you actually reach for when you can't be bothered to know which of those you have: it accepts a NUMBER, which in ComfyUI's type system means "an int or a float, I don't care," and returns its string form.

    Why you'd reach for it

    ComfyMath - the math-node pack by evanspearman - emits NUMBER outputs from its generic math nodes, and this is the one the quadmoon README specifically calls out as working with those. So if you're doing 5 + 3.5 in a math node and want the result in a filename or a prompt, this converter is your cleanest path. It's also just the lazy-correct choice when a value's type might change as you edit a workflow: grab the Number version and stop wondering whether that upstream node is really an INT or a FLOAT.

    How it works

    It checks that the input is an int or a float, then returns str(number_input). 42 becomes "42", 42.5 becomes "42.5" - Python's formatting, nothing fancy. Because it accepts both types, it's the least fussy of the four converters and the one a beginner is least likely to trip over.

    Inputs and outputs

    • number_input - the NUMBER to convert. The only input.
    • STRING - the output, for filenames, display nodes, or whatever else wants text.

    Installing it

    Part of traugdor's "quadmoon's ComfyUI nodes" pack. ComfyUI Manager: search the pack title, or Install via GIT URL with https://github.com/traugdor/ComfyUI-quadMoons-nodes.git. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/traugdor/ComfyUI-quadMoons-nodes.git
    

    Restart ComfyUI. No models or extra packages needed.

    Common issues

    Because it accepts both ints and floats, it rarely refuses an input - the one thing to watch is the same as the rest of the family: it wants a genuine numeric value, not a string that happens to look like a number. And keep in mind floats come out with their .0 (or whatever decimals), so if you're matching a filename later, match what Python actually printed.

    CategoryQuadmoonNodes/Converters

    Inputs (1)

    NameTypeDefaultDescription
    number_inputNUMBER

    Outputs (1)

    NameTypeDescription
    STRINGSTRING