Nodes/ComfyUI-ZML-Image/ZML_文本分离
ComfyUI Node

ZML_文本分离

Split one string in two at a separator — the node that does exactly that

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_文本分离
    • 文本_前缀
    • 文本_后缀
    分隔符_字符,
    文本_输入

    ZML_SplitText takes a string, cuts it at the first occurrence of a character you pick, and hands you the two halves. That's it - no magic, no model. But if you've ever needed to peel the name off the front of a filename or pull a tag out of a longer prompt, you know how often this trivial operation comes up. It's the kind of node you install a whole pack for and then wonder how you lived without.

    The mechanism is a single .split(separator, 1) style operation: everything before the separator goes to 文本_前缀, everything after it goes to 文本_后缀. Empty or blank input returns empty strings on both sides, so it degrades gracefully instead of erroring when nothing's connected.

    The inputs and outputs

    • 分隔符_字符 (required) - the character or short string to split on. Default is , (a comma). Change it to anything: a space, |, or the pack's own #-# filename separator.
    • 文本_输入 (optional) - the string to split. It's an input socket, so it can come from a filename loader, another text node, or a wire from anywhere upstream.

    Outputs are the two halves: 文本_前缀 and 文本_后缀.

    The reason #-# is worth remembering: the ZML save nodes join filename components with #-# (prefix, timestamp, counter, suffix). Feed one of those filenames through this node with #-# as the separator and you can recover the original prefix or suffix downstream - the save-node Help text explicitly describes that convention. It's the pack's little internal glue, and SplitText is the tool that unpicks it.

    Where it fits

    Practical uses: parse a "name#-#value" style string coming out of a loader, split a combined prompt to route the two parts to positive and negative encoders, or sanitize a filename before it hits a save node. Since the split is on the first occurrence, you can chain two of them if you need a three-way split - split once, then split the suffix again.

    It's a genuinely thin utility, so there's no deep troubleshooting: if the prefix and suffix don't look right, check that your separator actually appears in the input (a missing separator returns the whole string as the prefix and empty suffix). The node is part of ComfyUI-ZML-Image - install via ComfyUI Manager (search "ComfyUI-ZML-Image") or cd ComfyUI/custom_nodes && git clone https://github.com/zml-w/ComfyUI-ZML-Image, then restart. It's labeled ZML_文本分离 in the Chinese-default UI; the English patch translates it. No models or extra dependencies.

    Categoryimage/ZML_图像/文本

    Inputs (2)

    NameTypeDefaultDescription
    分隔符_字符STRING,
    文本_输入optSTRING

    Outputs (2)

    NameTypeDescription
    文本_前缀STRING
    文本_后缀STRING