ComfyUI Node

String to Float

Bridge a text value into a numeric input, without crashing on bad input

By DemonAlone·Created 7 months ago·Updated 22 days ago· 3
String to Float
    • FLOAT
    text_value

    A one-job node, and the job is exactly what it says: take text, hand back a number. You need this whenever a value is arriving as a STRING somewhere in your graph - pulled from a prompt template, extracted from a filename, or coming out of one of this pack's own list-generator nodes - and a downstream input (a denoise strength, a LoRA weight, a CFG override) needs an actual FLOAT connection instead.

    What it does

    One required input, text_value, a plain STRING. One output, FLOAT. If the text parses cleanly - "0.75", "1.2", whatever - you get that number out. If it doesn't parse as a float at all, the node doesn't crash your queue: per its own description, it logs the issue and returns 0.0 so the rest of your workflow keeps running.

    That's the whole node, and the whole point of it - it exists to be the boring, reliable seam between "text happened to this value at some point" and "a widget wants a real number now."

    ComfyUI is strict about connection types: a STRING output cannot plug into a FLOAT input, full stop, no automatic coercion. That's a reasonable design choice for the engine, but it means any graph that generates values as text - string concatenation, prompt templating, values pulled out of a filename or a list node - hits a wall the moment it needs to feed something numeric. This node (and its integer twin, String to Integer, elsewhere in this same pack) is the standard fix: a tiny, single-purpose converter that sits at exactly that seam.

    Installing it

    ComfyUI Manager: search DemonAlone-nodes-ComfyUI, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DemonAlone/SimpeStringGenerator_ComfyUI
    

    No dependencies or model downloads - pure Python glue.

    Where people get burned

    The silent fallback is the whole tradeoff here. Good, because a single bad value in a batch run won't kill the entire queue. Bad, because a typo'd number - an extra decimal point, a stray letter - quietly becomes 0.0 instead of throwing an error you'd actually notice. If a parameter downstream suddenly behaves like it's set to zero and you can't figure out why, check your ComfyUI console log for the parse-failure message this node logs when it falls back - that's usually the fastest way to spot it.

    Categoryutils

    Inputs (1)

    NameTypeDefaultDescription
    text_valueSTRING

    Outputs (1)

    NameTypeDescription
    FLOATFLOAT