Nodes/ComfyUI_StringOps/文本拆分🐠meeeyo.com
ComfyUI Node

文本拆分🐠meeeyo.com

Slice a block of text into five named chunks in one node

By MeeeyoAI·Created 2 years ago·Updated about a year ago· 209
文本拆分🐠meeeyo.com
    • STRING
    • STRING
    • STRING
    • STRING
    • STRING
    input_text
    delimiter标签符
    index1

    The thing that makes this node worth knowing: it gives you five string outputs at once. Most text tools in ComfyUI hand you one result and make you add another node when you want the next piece. ExtractLinesByIndex (labeled "文本拆分", part of the MeeeyoAI/ComfyUI_StringOps pack) takes a block of text, splits it, and walks five consecutive chunks out through five separate ports. If you're feeding a list of prompts, filenames, or config lines into separate branches of a workflow, that's exactly the shape of problem you keep running into.

    How it works

    Under the hood it's embarrassingly simple, which is why it's reliable: it splits your input_text on the delimiter string, then returns five pieces starting at the index you pick. The outputs are literally named 文本1 through 文本5 (text 1–5), one per port. A couple of details matter:

    • Delimiter: leave it as-is and it splits on newlines - each line becomes one chunk. Type any other string (like , or |) and it splits on that instead.
    • Index: 1-based. index = 1 gives you chunks 1–5; index = 3 gives you chunks 3–7. Going past the end doesn't error, it just pads with empty strings.
    • Outputs: all five are plain STRING. Wire whichever you need; the rest can dangle.

    So "take this text, give me line 2 and the three after it" is a zero-thought setup: drop text in, set index to 2, read 文本2, 文本3, 文本4.

    Where it fits

    In the wider StringOps picture, this is the batching helper. StringOps is mostly one-text-in-one-text-out utilities - replace, extract, filter. This is the one that fans a single blob out into several parallel strings, so it pairs naturally with the pack's other nodes downstream: run each output through ExtractSubstring or FilterLinesByWordCount and you've got a tiny text pipeline without ever touching a Python node.

    Install

    It ships in the ComfyUI_StringOps pack, so you get it with the rest. Easiest route is ComfyUI Manager - search "ComfyUI_StringOps" and install. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
    

    Then restart ComfyUI. The pack's requirements.txt (requests, numpy, torch, Pillow, openpyxl, chardet, pytz, ntplib) installs its own deps; nothing exotic, no model files to download. Heads up if you weren't expecting it: the node labels are Chinese with a fish emoji (🐠meeeyo.com branding), and the node description doubles as a contact ad for the author's WeChat - common in this pack, harmless.

    Common issues

    The one real trap is expecting it to split on something the delimiter isn't there. If the text has no delimiter and no newlines, you get the whole thing as chunk 1 and empty strings after. And remember the chunks come in a run starting at index - if you want line 1 and line 10, this isn't the node; you'd want ExtractSpecificLines from the same pack instead. Also note the index is 1-based; a beginner habit is typing 0 and wondering why nothing comes out.

    It's a small utility, not a headline feature - but it's the kind of node you install once, forget about, and quietly reach for every time a workflow needs to fan one text into several.

    CategoryMeeeyo/String

    Inputs (3)

    NameTypeDefaultDescription
    input_textSTRING
    delimiterSTRING标签符
    indexINT1

    Outputs (5)

    NameTypeDescription
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING