Nodes/ComfyUI_EmAySee_CustomNodes/EmAySee Remove Duplicates From String
ComfyUI Node

EmAySee Remove Duplicates From String

Dedupe a word list — and accept that it's going to sort itself

By EmAySee·Created about a year ago·Updated 4 months ago· 2
EmAySee Remove Duplicates From String
    • unique_list_string
    input_stringapple, banana, apple, orange, banana, grape

    Comma-separated words in, deduplicated words out. This node splits your string, keeps only unique entries, and returns them as a fresh comma-separated string. It's the first version of the pack's dedup pair - and it comes with a quirk you need to know before you use it for anything order-sensitive.

    How it works

    • input_string (multiline, defaults to apple, banana, apple, orange, banana, grape) - your word list.
    • Output unique_list_string - the deduped, comma-joined result.

    The mechanism is a Python set. That's great for uniqueness and terrible for ordering: sets don't preserve insertion order, so the author sorts the result alphabetically to make it deterministic. banana, apple, banana doesn't come back as banana, apple - it comes back as apple, banana. Every time. Consistent, but your original ordering is gone.

    The order problem, spelled out

    For prompt tags this is usually fine - tag order barely matters to most CLIP encoders, and alphabetical is as good as anything. But if you were hoping to keep "the first tag I wrote stays first," this node can't do it. That's precisely the difference between the two dedup nodes in this pack:

    • RemoveDuplicatesFromString (this one): dedupes via a set, then sorts alphabetically. Order is always lost.
    • RemoveDuplicatesFromStringV2: preserves first-seen order by default, with a sort_output toggle if you do want sorting.

    If order matters, go straight to the V2. If you just want a tidy unique list, this one is fine - just don't fight it.

    Other honest caveats

    Case-sensitive: Apple and apple survive as two entries. And like the CSV sibling in this pack, it only understands commas as separators - newlines or spaces won't split.

    Installing it

    Part of ComfyUI_EmAySee_CustomNodes. ComfyUI Manager → search the pack title → Install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes
    # restart ComfyUI
    

    Under EmAySee_Text, no dependencies. The display name in the menu is "EmAySee Remove Duplicates From String" - the V2 goes by the same title, which makes them easy to grab the wrong one. Check the widget count (V1 has one input, V2 has two).

    Bottom line

    It dedupes and it sorts, and it does both reliably. Need order kept? That's what the V2 is for - this one is the "I don't care about sequence" version.

    CategoryEmAySee_Text

    Inputs (1)

    NameTypeDefaultDescription
    input_stringSTRINGapple, banana, apple, orange, banana, grape

    Outputs (1)

    NameTypeDescription
    unique_list_stringSTRING