整数参数🐠meeeyo.com
Turning a '2|3' string into two usable integers
- INT
- INT
ComfyUI has a nasty habit of handing you numbers as strings. A ReadExcelData node returns cell values joined with |; a web node returns text; a text split returns pieces of a prompt. Meanwhile your sampler, your seed node, and your dimension nodes all want honest INTs. NumberExtractor is the bridge: feed it a string like 2|3 and it splits on the pipe, casts the first two pieces to integers, and hands you two INT outputs.
It's part of ComfyUI_StringOps, the same Chinese-market utility pack behind the Excel read/write nodes - and the pipe separator here is no accident. Read a row of Excel cells and you get 2|3|foo, exactly the format this node expects. The two nodes are designed to sit next to each other.
How it works
Dead simple, and that's the point. The input_text is split on |, the first two pieces are cast with int(), and each becomes an output:
- input_text - default
2|3. Anything pipe-separated works. - Output
INT#1 andINT#2.
The failure handling is where it gets friendly. If a piece isn't a number, you get 0 instead of a crash. If there's only one piece, the second output is 0. So abc|7 → 0, 7, and 5 → 5, 0. It's lenient by design - it won't throw your whole workflow because one cell had junk in it.
Where you'll actually use it
The obvious pairing is with ReadExcelData: read a 2-3 row range and a 1-2 column range, and the first two cells arrive as 2|3. Wire that straight into NumberExtractor, and now those Excel values drive real nodes - a seed, a batch size, an aspect ratio picker. You can also pipe the output of any of the pack's string ops into it, or just type 2|3 manually if you want two linked constants you can't forget to update together.
Installing it
From ComfyUI Manager, search ComfyUI_StringOps and install. Manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
Restart ComfyUI. No model downloads, no heavy deps - this pack's requirements are all things ComfyUI already ships except openpyxl (Excel) and requests (web), and those only matter if you use the Excel/web nodes.
The catch
It only ever extracts two integers. If your string is 1|2|3|4, the last two are silently dropped - you'd need a second node for a second pair. And it's strict about the format: it splits on | only, so 2,3 or 2;3 comes back as one garbage int (well, a 0). If you're splitting on commas, run the text through SimpleTextReplacer first to swap , → |, or just use the pack's TextToList + an index extractor instead. Small tool, sharp edges, but for the Excel-to-sampler bridge it's the fastest path in the pack.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input_text | STRING | 2|3 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |
| INT | INT | — |