Nodes/ComfyUI-LogicUtils/Manual Choice String
ComfyUI Node

Manual Choice String

Pull one item out of a delimited string by index

By aria1th·Created 3 years ago·Updated 7 months ago· 119
Manual Choice String
    • STRING
    input_stringa$b$c
    separator$
    index0

    Manual Choice String does one small, useful thing: you give it a delimited string like a$b$c, tell it which delimiter you're using, and give it an index, and it hands back that one item. It's the manual, deterministic sibling of the pack's random pickers - you're not letting a seed decide which value comes out, you're picking exactly the one you want, by position.

    Part of aria1th's ComfyUI-LogicUtils, a personal utility pack from the handle behind the Illustrious XL training work - a grab-bag of math, string, and logic helpers with a genuinely thin README ("proper documentation is being prepared, however there are too many nodes"). This is one of the more approachable nodes in it: no hidden state, no probability, just string indexing.

    Why you'd reach for it

    If you've got a batch of related values living in one string field - a list of style keywords, a rotation of camera angles, alternate phrasings of a prompt fragment - this lets you keep them together as one editable widget and pull out a specific one wherever your graph needs it, instead of maintaining a dozen separate string nodes. Change the index and you're pointing at a different item without touching the source list at all.

    How it works

    It splits input_string on separator and returns the element at position index (0-based, so index 0 is the first item). With the defaults - input_string = "a$b$c", separator = "$", index = 0 - you'd get "a" out.

    Inputs and outputs

    • input_string (STRING, default a$b$c) - the full delimited list, as one string.
    • separator (STRING, default $) - the delimiter to split on. $ is an unusual default precisely because it rarely shows up inside real prompt text, so it's safer than a comma if your items might themselves contain commas.
    • index (INT, default 0) - which item to return, 0-based.
    • Output: STRING - the item at index after splitting.

    How to install it

    ComfyUI Manager: search "ComfyUI-LogicUtils", install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/aria1th/ComfyUI-LogicUtils
    

    then restart ComfyUI. No models, no dependencies beyond the standard library - this is a pure string operation.

    Common issues & troubleshooting

    "Missing node type" on a shared workflow. Use ComfyUI Manager's "Install Missing Custom Nodes" to install the whole pack from the graph JSON.

    Import error at startup. The README documents an opt-in auto-installer for the pack's dependencies: COMFYUI_LOGICUTILS_AUTO_INSTALL=1 before launch to let it install what's needed, or COMFYUI_LOGICUTILS_SKIP_INSTALL=1 to disable that hook if it's misbehaving. ManualChoiceString itself needs nothing beyond Python's built-in string methods, so an import error is almost certainly from a different node in the pack.

    Index out of range. If index is larger than the number of items you get after splitting (or negative in a way the underlying Python list indexing doesn't like), expect an error rather than a silent empty string. Count your items carefully - remember index is 0-based, so a 3-item string only has valid indices 0, 1, and 2.

    Wrong item comes out. Almost always a separator mismatch - if your string actually uses commas but separator is still set to the default $, the whole string is treated as one single item and index 0 returns everything.

    CategoryLogic Gates

    Inputs (3)

    NameTypeDefaultDescription
    input_stringSTRINGa$b$c
    separatorSTRING$
    indexINT00–9223372036854776000

    Outputs (1)

    NameTypeDescription
    STRINGSTRING