GU String Lines
Split a prompt list into usable lines — GU String Lines
- str_list
- str_selected
- lines_count
If you've ever pasted ten prompt variants into one text box and wished you could hand them to a workflow one at a time, this is the node. GU String Lines takes a multi-line string, chops it into separate lines, and hands you three things: the whole list, a single line you pick by number, and a count. That's it. It's pure plumbing from the GU_Nodepack utility family, and it sits in the same unglamorous-but-always-needed category as every other text-splitting node in the ecosystem.
Why you'd reach for it: batch work. Type your variations into str_in (one per line), grab the list and loop over it, or grab one specific line and feed it into a CLIP text encoder for a quick A/B test. The GU example workflow uses it exactly that way - a three-line block of test prompts split out for inspection.
How it works
Under the hood it's simpler than the node title suggests. The code splits str_in on newlines, strips whitespace from each line, and drops empty ones. A trailing blank line, a stray double newline, none of those survive. The three outputs are then:
- str_list - the list of cleaned, non-empty lines (a true list output, so loop nodes can consume it).
- str_selected - the one line at
sel_index. If the index is out of range you get an empty string back, not an error. - lines_count - how many lines are in the list, handy for wiring into a loop's max-iteration input.
The inputs that matter
Only two, and a beginner sets one of them. str_in is the multiline text box where your lines go. sel_index is a 0-based integer (starts at 0, goes up to 9999) that picks which line lands on str_selected. Remember it's zero-based - the first line is index 0, and if you're coming from A1111-style 1-based thinking you'll grab the wrong line once before you remember.
The lines_count output is the quietly useful one: feed it into a loop bound or a batch-size calculator and the whole thing self-sizes as you add or remove lines.
Installing it
This node ships in the GU_Nodepack, so you install the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/alexguryev/ComfyUI-GU_Nodepack
Then restart ComfyUI. Easier path: open ComfyUI Manager → Install Custom Nodes, search for GU_Nodepack, and let it handle the clone plus the pip dependencies (psutil, requests, and gu-funclib - the pack's shared library). There are no model files to download for this node; it never touches pixels or weights.
Gotchas
A few small ones. Because this is a plain (non-output) node, ComfyUI's cache decides when it runs - if nothing downstream actually reads it, it may not execute at all, so make sure its outputs are connected where you expect. sel_index out of bounds returns an empty string rather than failing loudly, which can silently blank a prompt in a loop if your index drifts. And blank lines being stripped means lines_count may be lower than the number of lines you typed - that's the feature, not a bug.
One more note from the pack author: GU_Nodepack is tested on Windows, with Linux/macOS best-effort, and is designed for single-user ComfyUI. Race conditions have been known to show up in multi-user setups. For a single box, you'll be fine.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| str_in | STRING | — | |
| sel_index | INT | 00–9999 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| str_list | STRING | — |
| str_selected | STRING | — |
| lines_count | INT | — |