Nodes/ComfyUI-GU_Nodepack/GU String To Values
ComfyUI Node

GU String To Values

Turn a comma string into typed numbers — GU String To Values

By alexguryev·Created 4 months ago·Updated 23 days ago· 2
GU String To Values
    • string_list
    • float_list
    • int_list
    string1.1, 2.3, 3.7
    out_type

    Somewhere in every workflow you hit the same annoyance: a number sitting inside a text string, when the thing downstream wants an actual numeric input. GU String To Values exists to bridge that gap. You feed it a string like 1.1, 2.3, 3.7, tell it what type you want out, and it hands you a parsed list - as strings, floats, or integers, your choice. It's the "convert a text box into typed values" utility from GU_Nodepack, and it earns its keep the moment you start driving parameters from strings instead of typing them.

    Where this actually comes up: a seed list you pasted from somewhere, a comma-separated strength list, width/height pairs, a batch of scale factors. Any time a number arrives as text - from a wildcard file, from another node's string output, or from your own lazy pasting - this is the clean way to make it numeric. It's the plumbing-layer cousin of the typed primitive nodes in core ComfyUI, just with the parsing built in.

    How it works

    The mechanism is deliberately boring: split on commas, parse each element, and - this is the important bit - the code returns zeroes for anything it can't parse instead of erroring out. Bad number in, zero out, no crash. The author's own description puts it bluntly: "If numbers are incorrect - return zeroes."

    The out_type dropdown (string / float / integer) decides which of the three output sockets actually carries data. They're all always present:

    • string_list - the raw split elements, whitespace intact, no parsing.
    • float_list - parsed as floats (leading/trailing spaces are stripped first, so " 2.3 " parses fine).
    • int_list - parsed as integers, and the parsing here is strict: int(x) with no cleanup, so "3 " or "3.0" both fail and quietly become 0. That strictness is the one real trap.

    The inputs that matter

    Just two. string is the multiline text box with your comma-separated values. out_type is the dropdown that picks the output type - and the tooltip spells out the intended pattern: pick the type, then use the matching output slot. If you leave it on the default empty string and read the float output, you get an empty list.

    Installing it

    Part of GU_Nodepack, so install the pack once:

    cd ComfyUI/custom_nodes
    git clone https://github.com/alexguryev/ComfyUI-GU_Nodepack
    

    Restart ComfyUI, or use ComfyUI Manager → Install Custom Nodes → search "GU_Nodepack", which also pulls in the pip deps (psutil, requests, gu-funclib). No models, no downloads. Windows is the tested platform; Linux/macOS is best-effort, and the pack assumes a single-user ComfyUI.

    Gotchas

    The integer strictness is the one that bites: feed it clean integers only, no spaces, no decimal points, or you get zeroes with no warning. And because the three outputs are always declared but only one gets filled, make sure the socket you're reading matches your out_type - reading the float socket after choosing "integer" gives you an empty list, which downstream often reads as "no data at all" rather than an error. For genuinely thin needs - splitting one number instead of a list - a core primitive or a simple string-split node is lighter; this node pays off when you're feeding a comma string into batch or loop parameters.

    CategoryGU_Nodepack

    Inputs (2)

    NameTypeDefaultDescription
    stringSTRING1.1, 2.3, 3.7string list of values, separated by commas
    out_typeCOMBOoutput data type + use appropriate out slot

    Outputs (3)

    NameTypeDescription
    string_listSTRING
    float_listFLOAT
    int_listINT