ComfyUI Node

Integer to String

Turn numbers into text for prompts and filenames

By HavocsCall·Created 2 years ago·Updated 9 months ago· 4
Integer to String
    • String
    Integer

    Integer to String converts an INT into a STRING, which sounds pointless until you realize ComfyUI is full of places where you want a number as text - building a prompt that includes a count, a size, or a seed, or composing a filename. It's a tiny adapter, but it's the sort of node that unblocks whole workflows.

    When you'd use it

    The classic case is dynamic prompts: "a group of {n} people", "a {w}x{h} billboard", "version {seed}". You compute a number somewhere in the graph - a random integer, a Logic Compare result, a counter - and you want it rendered into the prompt string itself. Prompts are strings, so the number has to become text first. Same deal for filenames: Save Image's prefix is a string, so a step count or seed as text needs this conversion before it can be part of a name.

    Pair it with Combine String or Prompt Combiner (both in this pack) and you can assemble a prompt with live numbers in it, regenerating with a new value each run.

    How it works

    str(Integer) - that's the whole implementation:

    result = str(Integer)
    

    No formatting options, no padding, no thousand separators. 42 becomes "42". If you need zero-padded or formatted output (007 instead of 7), this isn't the node - you'd want a format/string-format node from another pack.

    Inputs:

    • Integer - INT input socket (forceInput).

    Output:

    • String - the number as text.

    Where people get burned

    The main trap is expecting formatting that isn't there. ComfyUI's other conversion helpers sometimes let you control width or padding; this one is a straight cast. Related gotcha: forceInput means no typed values - everything comes in on a wire, so you'll need an Integer Selector or a math/compare output upstream.

    Worth noting for the completeness nerds: the reverse direction exists in the pack too - a Float to String and String-to-Integer and String-to-Float. The string-to-number ones return 0 on invalid input instead of erroring, which is a design choice worth knowing if you chain them (a malformed string silently becomes 0 rather than telling you something's wrong).

    Installing it

    ComfyUI Manager → search "HavocsCall" → install → restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/HavocsCall/comfyui_HavocsCall_Custom_Nodes
    

    Restart, under HavocsCall/Conversion. No requirements.txt, no model downloads - instant.

    CategoryHavocsCall/Conversion

    Inputs (1)

    NameTypeDefaultDescription
    IntegerINT

    Outputs (1)

    NameTypeDescription
    StringSTRING