Nodes/Comfyroll Studio/πŸ”€ CR Split String
ComfyUI Node Runs on cloud

πŸ”€ CR Split String

Break one string into up to four pieces on a delimiter

By Suzie1Β·Created 3 years agoΒ·Updated 2 years agoΒ· 1,296
πŸ”€ CR Split String
    • string_1
    • string_2
    • string_3
    • string_4
    • show_help
    β—„texttextβ–Ί
    β—„delimiter,β–Ί

    You've got one string carrying several pieces of information - a combined tag list, a filename with parts separated by underscores, a metadata string someone else's node spat out - and you need those pieces separated so you can wire them individually. CR Split String does exactly that: give it text and a delimiter, get back up to four separate strings.

    How it works

    text is whatever you're splitting - a single-line string field, so no multiline prompts here. delimiter is optional and defaults to a comma; set it to whatever character actually separates your pieces (an underscore, a pipe, a space). The node splits on that character and sends the resulting pieces out through string_1 through string_4, in order.

    That cap is worth knowing up front: four outputs, no more. If your text splits into more than four pieces, only the first four come out - the rest are simply dropped, not queued somewhere or concatenated back together. If your source string can realistically have more segments than that, this isn't the right node; you'd want something that returns a proper list instead (CR Text List, for instance, if you can get your data onto separate lines).

    One practical thing to watch: a plain split doesn't trim whitespace. If your delimiter is ", " (comma-space) but you set the delimiter field to just ,, you'll get pieces like " dog" with a leading space rather than "dog". Either match your delimiter exactly to what's in the source string, or account for the stray space downstream.

    The inputs and outputs that matter

    • text - the string you're splitting.
    • delimiter - optional, defaults to ,. Set it to match whatever actually separates your data.

    Outputs: string_1 through string_4, each typed as ComfyUI's wildcard * so they'll wire into a STRING socket or most other text-consuming inputs without complaint, plus the standard show_help wiki 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 heavy dependencies - this is plain string handling.

    Common issues

    Getting fewer pieces than you expected. Check that your delimiter field actually matches the character in your text - a mismatch (say the string uses semicolons but you left the delimiter at the default comma) just returns your whole string in string_1 and empty strings everywhere else, with no error to flag it.

    More than four segments in your source. Only the first four survive. If you're regularly splitting something with a variable or larger number of parts, this node's fixed output count is the wrong tool - reach for a list-based node instead.

    Stray whitespace in the output. As above - a naive split doesn't trim. If downstream comparisons or lookups are failing mysteriously (a CR String To Combo not matching an expected value, for instance), a leading or trailing space picked up from the split is a common, easy-to-miss cause.

    And if the node isn't in your search results at all, that's the pack-wide failure mode: Comfyroll loads its entire node set from one file, so one broken import (commonly an incompatible Pillow version dragged in by another custom node) takes the whole pack down. Check your ComfyUI console for Comfyroll Studio: Failed to load ... nodes and reinstall Pillow or update the pack through Manager.

    Category🧩 Comfyroll Studio/πŸ› οΈ Utils/πŸ”€ Text

    Inputs (2)

    NameTypeDefaultDescription
    textSTRINGtextβ€”
    delimiteroptSTRING,β€”

    Outputs (5)

    NameTypeDescription
    string_1*β€”
    string_2*β€”
    string_3*β€”
    string_4*β€”
    show_helpSTRINGβ€”