Nodes/Comfyroll Studio/πŸ”§ CR String To Number
ComfyUI Node Runs on cloud

πŸ”§ CR String To Number

Parse text into an INT and a FLOAT at once

By Suzie1Β·Created 3 years agoΒ·Updated 2 years agoΒ· 1,296
πŸ”§ CR String To Number
    • INT
    • FLOAT
    • show_help
    β—„texttextβ–Ί
    β—„round_integerβ–Ύβ–Ί

    If a number is trapped inside a string somewhere in your graph - pulled out by CR Split String, extracted with CR Get Parameter From Prompt, or just typed by hand as text for some reason - CR String To Number is the node that turns it back into something you can actually do math on, or wire into a numeric widget.

    How it works

    Type or wire in text - something that reads as a number, like "3.7" or "12". The node parses it and hands back both an INT and a FLOAT from the same value, so whichever type the next node wants, you've got it without a second conversion step.

    The one setting that actually matters here is round_integer, and it only affects the INT output: choose round for standard rounding, round down to always truncate toward zero, or round up to always round toward the ceiling. If your string parses to a whole number already ("12"), this setting is irrelevant - it only kicks in when the value has a fractional part, like turning "3.7" into 4 (round up), 3 (round down), or 4 (round, since .7 rounds up). The FLOAT output is unaffected either way - it always carries the full precision of whatever the string parsed to.

    The inputs and outputs that matter

    • text - the string to parse. Needs to actually be a valid number; extra characters or an empty string will fail to parse rather than silently return zero.
    • round_integer - round, round down, or round up. Controls only the INT output's rounding behavior.

    Outputs: INT, FLOAT, and the standard show_help link.

    How to install it

    ComfyUI Manager - search "Comfyroll Studio", install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git
    

    then restart. No models, no dependencies - pure text parsing.

    Common issues

    Parse errors. If your input string has anything besides digits, a decimal point, and maybe a leading minus sign - stray whitespace, a trailing unit, a comma used as a thousands separator - the parse fails. This is the exact trap you can walk into if your text came out of CR Split String on a delimiter that left a leading space (" 3.7" instead of "3.7"); trim upstream rather than fighting it here.

    INT output looks "wrong" for your use case. Remember round_integer only controls that one output. If you actually need the value truncated but left round_integer on the default round setting, you'll get standard rounding instead - check which of the three you actually picked.

    Node missing entirely. That's a pack-wide load failure, not this node specifically. Check your ComfyUI console for Comfyroll Studio: Failed to load ... nodes - usually a Pillow version conflict from another custom node pack - and reinstall Pillow (pip install --upgrade --force-reinstall pillow) or update Comfyroll through Manager.

    Category🧩 Comfyroll Studio/πŸ› οΈ Utils/πŸ”§ Conversion

    Inputs (2)

    NameTypeDefaultDescription
    textSTRINGtextβ€”
    round_integerCOMBO3 options: round, round down, round up

    Outputs (3)

    NameTypeDescription
    INTINTβ€”
    FLOATFLOATβ€”
    show_helpSTRINGβ€”