String Lines Count (Yogurt Nodes)
Count the lines in your prompt lists, so your workflow knows how much it's about to do
- count
- text1
- text2
- text3
- text4
- text5
- text6
- text7
- text8
You've got a multiline text box with ten prompts in it, one per line, and you're about to feed them into a batch scheduler. Wouldn't it be nice if the workflow itself knew there were ten? That's the whole job of YogurtStringLinesCount: it tells you how many lines are in a multiline string, so the rest of the graph can react to the size of its own input.
Why you'd reach for it
Batch workflows get unwieldy fast. You paste a prompt list, wire it to a LatentFromBatch or a scheduler, and then eyeball "how many did I put in there?" whenever you change it. This node turns that into a real signal: the count output is an INT you can use to set a batch size, drive a YogurtRange, or guard a loop. It's the difference between a graph that just runs and one that knows what it's running.
How it works
Up to eight multiline text1–text8 inputs go in, and the node splits them on line breaks and reports the total as count (INT). Two toggles control what counts as a line:
no_strip- when off (default), lines are stripped of surrounding whitespace before counting, so a line of just spaces doesn't inflate your total. Flip it on if whitespace genuinely matters.keep_empty_lines- when off (default), empty lines are skipped. Turn it on if you're using blank lines as intentional separators and want them counted.
There's also a concat_method dropdown with concat and product. Leave it on concat unless you know what you're doing - product is a cartesian-combination mode that exists for the pack's fancier matrix workflows, and it's not what you want when you just need a line count.
The node also echoes text1–text8 back out, so it can sit inline in a chain without you having to reroute the originals around it. Handy when you're counting in the middle of a pipeline rather than at the end. And yes, this is an output node - it's meant to be looked at, so it shows up as a display in the graph.
Where the count goes
Common wiring: count → batch-size input on your sampler or an ImageBatch → so the batch always matches the prompt list. Or count → a conditional that skips an upscale pass when you're only generating one image. It's a small node, but it removes a whole class of "wait, I only fed it five, why did it render eight" moments.
Installing it
Install the Yogurt Nodes pack once - via ComfyUI Manager (search "ComfyUI-YogurtNodes") or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt
Restart ComfyUI and you'll find it under YogurtNodes/String. No model downloads, no API keys - this one is pure Python string handling.
Gotchas
Empty input is not a crash - an empty multiline box counts as zero lines, so the node won't blow up on an unset prompt list. And with the defaults (keep_empty_lines off, no_strip off), a trailing newline doesn't count as a phantom line, since empty and whitespace-only lines get skipped. If your count is consistently one higher than you'd expect, check that there isn't a stray blank line hiding at the end of the box - that's the usual culprit.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| no_strip | BOOLEAN | false | — |
| keep_empty_lines | BOOLEAN | false | — |
| concat_method | COMBO | concat | 2 options: concat, product |
| text1opt | STRING | — | |
| text2opt | STRING | — | |
| text3opt | STRING | — | |
| text4opt | STRING | — | |
| text5opt | STRING | — | |
| text6opt | STRING | — | |
| text7opt | STRING | — | |
| text8opt | STRING | — |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| count | INT | — |
| text1 | STRING | — |
| text2 | STRING | — |
| text3 | STRING | — |
| text4 | STRING | — |
| text5 | STRING | — |
| text6 | STRING | — |
| text7 | STRING | — |
| text8 | STRING | — |