Nodes/ComfyUI-JNK-Tiny-Nodes/Split String JNK
ComfyUI Node

Split String JNK

Split text into a real list, with skipping and limits built in

By AljnkΒ·Created about a year agoΒ·Updated 12 months agoΒ· 3
Split String JNK
    • text_list
    β—„textβ€”β–Ί
    β—„delimiter,β–Ί
    β—„start_index0β–Ί
    β—„skip_every0β–Ί
    β—„max_count100β–Ί

    ComfyUI's built-in text handling mostly gives you one string at a time, and when a workflow needs a list of strings - feed a batch of prompts, iterate over tags, pass several filenames to a loader - you end up writing text-mangling nodes or pasting values in by hand. "Split String JNK" is the pack's answer: take one blob of text, split it on a delimiter, and hand you a proper list output that other nodes can iterate. Added in v1.1.3 of the pack specifically because people kept asking for "advanced text splitting."

    The mechanism is where it beats a naive split(). It splits text on your delimiter, strips each piece, and drops empty lines. Then it applies three filters in one slice operation:

    • start_index - skip the first N items and start there.
    • skip_every - take every Nth item after that (0 means take everything; 1 means take every other one).
    • max_count - cap the number of items returned (default 100).

    The delimiter deserves a note because it's sneakier than it looks: it's decoded as a Unicode escape, so you can use \n for newlines and \t for tabs in the field and they'll behave. Set it to empty and the whole text is treated as a single item. That one line makes the node genuinely useful for config files, tag lists, or prompt sheets you've pasted in.

    The output is the key thing to understand: text_list is a list of strings (the schema marks it is_list: true), not a joined string. That means it plugs straight into anything that accepts a list of strings - batch loaders, list-index nodes, or this pack's own "Get Text From List by Index." It's an actual typed list, which a lot of beginner workflows stumble on because most "split" utilities you find online hand you one concatenated string back.

    The inputs you'll actually touch:

    • text - the blob to split.
    • delimiter - what to cut on; defaults to a comma.
    • start_index / skip_every / max_count - the filtering trio, all optional if you just want a clean full split.

    Install: ComfyUI Manager β†’ search "JNK" β†’ Install, then restart. Or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/Aljnk/ComfyUI-JNK-Tiny-Nodes.git
    

    Then restart. No extra Python deps - this is pure stdlib string handling.

    Gotchas: the skip_every semantics are easy to misread. It's not "skip N items" - it's "take every (N+1)th item." A value of 2 takes items 0, 3, 6… If you just want a normal split with a limit, leave skip_every at 0 and use max_count. And start_index counts items after splitting, so if your text has leading blank lines you might be skipping something you didn't intend - though empty items are stripped first, which covers most cases. It's a small node with one real job, and for feeding batches of text it's the one that actually works.

    CategoryπŸ”§ JNK

    Inputs (5)

    NameTypeDefaultDescription
    textSTRINGβ€”
    delimiterSTRING,β€”
    start_indexINT00–1000β€”
    skip_everyINT00–10β€”
    max_countINT1001–1000β€”

    Outputs (1)

    NameTypeDescription
    text_listSTRINGβ€”