String Lines Switch (Yogurt Nodes)
Pull line 3 out of a prompt list and feed it somewhere else
- string
- int
- float
- count
Every prompt-list workflow eventually needs one line out of the middle. You keep ten prompts in a multiline box, the graph runs one per iteration, and at some point you need "the prompt at position 4" as a standalone value - for a comparison, a save name, a conditional. YogurtStringLinesSwitch is the node that reaches into a multiline string, grabs the line you ask for, and hands it back to you as a string and a number. Description on the box: "Get line from multiline string by index." That's the whole deal.
How it works
Feed up to eight multiline text1–text8 inputs, set index (an INT, default 0), and the node pulls the line at that position. Then it hands you the same value four ways:
string- the raw line as textint- the line parsed as an integer, when that makes sensefloat- the line parsed as a floatcount- how many lines were available in total
The last output is the quiet hero. You get the selected line and the size of the list, so a downstream node can check "did I even ask for a valid index?" without a second count node.
Like its sibling String Lines Count, it has no_strip and keep_empty_lines toggles that decide whether whitespace-only lines exist for indexing purposes, and a concat_method with concat / product options. Leave concat alone unless you're deliberately working with the pack's product-combination mode. The product_concat_delimiter and product_order fields only matter in that mode, so a beginner can ignore them entirely.
The genuinely useful bit: int and float outputs
Here's where this node earns its place. Because it parses the line for you, a multiline list can double as a tiny configuration table. Put
512
640
768
in a text box, feed it in, set index to 1, and the int output is a real 640 - wire it straight into a width input. No manual YogurtStringToValue conversion, no stale values you have to retype. This makes it a neat poor-man's config store for batch jobs: one box, many numbers, selected by index.
Installing it
Part of the Yogurt Nodes pack - one install covers all of them. ComfyUI Manager (search "ComfyUI-YogurtNodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt
Restart, look under YogurtNodes/String. Pure Python, no models, no keys.
Where people get burned
Out-of-range index. Ask for line 4 when the list has 3 lines and behavior gets undefined-ish - the pack doesn't promise what you get, so guard it: wire count into a comparison before letting the index drive anything important. Also remember index is zero-based, same as Python. If the node returns the second line when you think you asked for the first, that's it, that's the bug, and everyone hits it once.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| no_strip | BOOLEAN | false | — |
| keep_empty_lines | BOOLEAN | false | — |
| index | INT | 0 | — |
| concat_method | COMBO | concat | 2 options: concat, product |
| product_concat_delimiter | STRING | — | |
| product_order | STRING | 0,1,2,3,4,5,6,7 | — |
| text1opt | STRING | — | |
| text2opt | STRING | — | |
| text3opt | STRING | — | |
| text4opt | STRING | — | |
| text5opt | STRING | — | |
| text6opt | STRING | — | |
| text7opt | STRING | — | |
| text8opt | STRING | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| string | STRING | — |
| int | INT | — |
| float | FLOAT | — |
| count | INT | — |