Nodes/ComfyUI-Danbooru-Gallery/简易字符串分隔 (Simple String Split)
ComfyUI Node

简易字符串分隔 (Simple String Split)

Turn one comma-separated tag string into a clean list

By Aaalice233·Created 11 months ago·Updated 24 days ago· 224
简易字符串分隔 (Simple String Split)
    • STRING
    string
    split

    Danbooru-style prompts are one long comma-separated string - 1girl, solo, blue hair, looking at viewer, masterpiece - which is great for typing and useless the moment you need to do something to each tag individually: filter one out, randomize the order, feed them one at a time into a loop. SimpleStringSplit is this pack's answer: hand it a string and a delimiter, and it hands back a proper list of clean, trimmed tags instead of one long blob.

    It lives inside ComfyUI-Danbooru-Gallery, a 23-node pack from a solo author - "this is my first node... built with the assistance of AI," by their own description - built around pulling images and tags off Danbooru and cleaning up the resulting prompts. SimpleStringSplit is one of a handful of generic string/workflow-control utilities the pack throws in - the kind of small glue node most prompt-heavy workflows eventually need, whether or not you ever touch the Danbooru gallery side of the pack.

    How it works

    Give it a string and it splits on whichever delimiter you pick, then - and this is the part worth knowing about - strips the leading and trailing whitespace off every resulting piece before handing back the list. That's a real fix for a real problem: "spaces after commas" is a well-known footgun in booru-style prompting, since a stray leading space in a tag can change how it tokenizes. This node quietly cleans that up instead of passing through " blue hair" with the space still attached.

    Inputs and outputs

    • string (required) - the blob to split. Defaults to empty, so you'll almost always feed it from somewhere: a text box, a Danbooru gallery output, an earlier prompt-cleaning node.
    • split (optional) - the delimiter. The schema exposes exactly two choices: comma and pipe (, / |). If your source string uses something else, split on whichever's closer or normalize it with a text node first.
    • Output - a STRING list, every element trimmed, ready to feed into anything downstream that wants one tag at a time: a random-pick node, a per-tag switch, a loop.

    Installing it

    Same as the rest of the pack. Via ComfyUI Manager: search "ComfyUI-Danbooru-Gallery," install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Aaalice233/ComfyUI-Danbooru-Gallery.git
    cd ComfyUI-Danbooru-Gallery
    pip install -r requirements.txt
    

    then restart ComfyUI. This particular node needs nothing beyond basic string handling - the requirements file (requests, aiohttp, aiosqlite, psutil, plus Pillow/torch/numpy) is for the pack as a whole, chiefly the Danbooru-fetching and image-handling nodes.

    Common issues & troubleshooting

    Output is a list, and a downstream node chokes on it. SimpleStringSplit always returns a list, even for a one-item string with no delimiter in it at all. If you're plugging it into something that expects a single string, you need a node in between that reduces the list - that isn't this node's job.

    Widget labels are in Chinese by default. The pack's front end ships with multi-language support as a built-in JS extension, but Chinese is the default. Look for a gear/settings icon elsewhere in the pack (other users report finding one) if the tooltips look unfamiliar.

    Node doesn't show up. Standard checklist for this pack: the folder must be exactly ComfyUI/custom_nodes/ComfyUI-Danbooru-Gallery, pip install -r requirements.txt has to finish clean, and you need to actually restart - then check the console on boot for an import error, per the README's own first troubleshooting step.

    Categorydanbooru

    Inputs (2)

    NameTypeDefaultDescription
    stringSTRING要分割的字符串
    splitoptCOMBO分隔符类型

    Outputs (1)

    NameTypeDescription
    STRINGSTRING