Nodes/ComfyUI_StringOps/获取浮点数🐠meeeyo.com
ComfyUI Node

获取浮点数🐠meeeyo.com

The text-to-float bridge for config lines and batch output

By MeeeyoAI·Created 2 years ago·Updated about a year ago· 209
获取浮点数🐠meeeyo.com
    • FLOAT
    • STRING
    input_text
    target_char

    GetFloatParam (获取浮点数 - "get float") is the floating-point twin of GetIntParam, and it solves the same boring but constant problem: a node hands you text, another node wants a number, and the number lives somewhere inside that text. Give it a marker, it finds the line, cuts the value out, and hands you a real FLOAT - plus the raw string so you can see what actually came out.

    How it works

    Two inputs: input_text (a wired-in STRING - the field is force-input, so you'll connect an upstream string rather than type) and target_char, the marker to search for. It runs the same line-scan as FindFirstLineContent / GetIntParam from this pack: first line containing the marker, everything after the marker is the value. Then it parses that as a float.

    Two outputs: a FLOAT and a STRING (the raw remainder). If the remainder can't be parsed as a float, the float port returns None; if the marker isn't found, you get None plus an empty string. The string output doubles as your sanity check - when the float comes back None, the string port shows you exactly what the marker left behind, which is usually a stray character or a space.

    Example: a line strength: 0.85 with target_char = "strength: " → FLOAT 0.85. Works with decimals, negatives, scientific notation - whatever Python's float() accepts.

    Why you'd reach for it

    Whenever a workflow encodes parameters as text - a batch config file, an upstream node that emits key: value lines, a prompt list that carries settings - and you need those numbers in numeric ports, this is the bridge. It's also the natural follow-up to the pack's text extractors: FindFirstLineContent gets you the raw line, this gets you the number. Same shape as GetIntParam; pick by what type your downstream port demands.

    Install

    Same pack as everything else:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
    

    Restart ComfyUI. Or ComfyUI Manager → search "ComfyUI_StringOps". No model downloads, nothing exotic in requirements.txt. Chinese UI (获取浮点数) with the 🐠meeeyo.com fish branding and a WeChat contact ad in the node description, standard for this pack.

    Common issues

    The gotchas are the shared line-scan ones, plus one float-specific trap. Comma decimals break it: a value like 0,85 (European-style decimal) won't parse - it needs a dot. Whitespace again: if the marker doesn't include the trailing space, your remainder is " 0.85" - that actually parses fine, but "0.85px" or "0.85 " with a trailing newline can still trip you, so keep the marker tight. Containment matching: data matches metadata, and first match wins - be specific. None, not error: a failed parse gives None on the float port, which is easy to mistake for a broken node until you look at the string port.

    For the "I need a float out of a text line" case, it's the right tool, and it's hard to do simpler. When the value you need is an integer instead, reach for GetIntParam - same layout, INT output.

    CategoryMeeeyo/String

    Inputs (2)

    NameTypeDefaultDescription
    input_textSTRING
    target_charSTRING

    Outputs (2)

    NameTypeDescription
    FLOATFLOAT
    STRINGSTRING