Nodes/ComfyUI-YogurtNodes/String To Value (Yogurt Nodes)
ComfyUI Node

String To Value (Yogurt Nodes)

The fastest way to turn '42' into a number ComfyUI can actually use

By yogurt7771·Created 2 years ago·Updated 4 days ago· 1
String To Value (Yogurt Nodes)
    • string
    • int
    • float
    text

    Half of ComfyUI's inputs are numbers, but the stuff coming out of text boxes, file paths, and LLM responses is text. "512" is not the same thing as 512 to a node that wants a width, and you will absolutely hit the day where a workflow refuses to connect because a string won't coerce itself. YogurtStringToValue is the three-output conversion node that fixes it: one text input, and it hands you the same value as a string, an int, and a float.

    What you get

    Required input is just text (a multiline STRING). Outputs:

    • string - the original text, passed through untouched
    • int - the text parsed as an integer, when it parses
    • float - the text parsed as a float, when it parses

    That passthrough on string is the quiet convenience: the node can sit inline in a chain and convert without forcing you to reroute the original around it.

    How people actually use it

    The number-from-text pattern shows up everywhere once you're past the default workflow. A saved filename contains the resolution - scene_512.png - and you want that 512 as a real value for an EmptyLatentImage. A YogurtStringLinesSwitch pulls a line out of a config list, and the int output handles it without a separate conversion step. Or an LLM node returns "3" in its text output and you want to feed a batch size with it.

    The int/float split means you don't have to think about which one you'll need - both are there, and you just connect the one that matches the target input. Text that doesn't parse (like "3 apples" to an int) simply doesn't produce a sensible value on that output, so feed it clean numeric text if you need the typed outputs.

    Installing it

    It's part of the Yogurt Nodes pack under YogurtNodes/String. Install once via ComfyUI Manager (search "ComfyUI-YogurtNodes") or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
    cd ComfyUI-YogurtNodes
    pip install -r requirements.txt
    

    Restart ComfyUI. Pure string parsing - no models, no dependencies worth mentioning beyond the pack's shared install.

    Where it bites

    Same caveat as every parse node: garbage in, nothing useful out. If you wire a non-numeric string into a node expecting int, the value you get isn't defined by the schema, so don't count on it - sanitize upstream. And remember this converts text that happens to be a number; it won't round, it won't parse "1,024" (that comma is a killer - run it through YogurtStringSplit and a join first if your numbers have thousand separators). For everything else it's the boring, correct little node you'll keep reaching for.

    CategoryYogurtNodes/String

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (3)

    NameTypeDescription
    stringSTRING
    intINT
    floatFLOAT