π§ RangeToString (Dehypnotic)
Generate 0,1,2,3,4 as a string β RangeToString (Dehypnotic)
- STRING
Sometimes a workflow just needs 0,1,2,3,4,5 as plain text, and no amount of typing makes that feel better. RangeToString (Dehypnotic) is the utility that turns a start, an end, and a step into a single string, so you can stop hand-typing number lists into prompt fragments, filename schemes, and video frame ranges.
The node is a thin wrapper around Python's built-in range() - nothing smarter, and that's the appeal. Feed it start, end, and step as integers, pick a separator, and it hands you one STRING on the output. Two knobs on top: mode decides whether end is included, and separator doesn't have to be a comma. The author's own README table is the cleanest summary, and I verified every row against the shipped code:
| start | end | step | separator | mode | output | |-------|-----|------|-----------|-----------|-------------| | 0 | 5 | 1 | , | inclusive | 0,1,2,3,4,5 | | 0 | 5 | 1 | , | exclusive | 0,1,2,3,4 | | 5 | 0 | -1 | , | inclusive | 5,4,3,2,1,0 | | 5 | 0 | -1 | ; | exclusive | 5;4;3;2;1 |
The last two rows are the part people miss. step goes negative - it spans -999999 to 999999 - so descending ranges work, and swapping separator to ; (or a newline, or a space) gives you something that isn't comma-soup. The only input that ever trips anyone up is mode: inclusive includes end, exclusive stops one short of it, and which one you want depends on whether whatever you're feeding treats the list as a set of labels or a count.
Wire the STRING output anywhere a string is accepted - text concatenation, a prompt segment, a filename template, a video node's frame-range field. The honest caveat: it emits one value in one pass. There's no iteration, no "generate once per number", no loop. If you came here expecting it to fan a range out into multiple jobs, that's a different kind of node and this isn't it. Related Python quirk, worth having in your head: range() only travels the direction step points, so start=5, end=0, step=1 returns an empty string rather than an error. Flip step to -1 and you're set.
Troubleshooting is mostly two questions: did I point step the right way, and inclusive or exclusive? Step 0 throws a ValueError - and the author's message is in Norwegian ("Step kan ikke være 0"), which tells you exactly how small this project is: a single file, zero dependencies, no model downloads, MIT licensed. None of the usual ComfyUI dependency hell.
Installing it is equally small:
cd ComfyUI/custom_nodes
git clone https://github.com/Dehypnotic/comfyui-range-to-string
Restart ComfyUI and it appears under Dehypnotic / π Text Utils. No pip install, no requirements, no models. ComfyUI Manager can also grab it, but the README only documents the "Install from URL" route, which asks you to drop Manager's security_level to weak in config.ini first - the git clone above skips all of that, so that's the path I'd use.
For something this tiny, the verdict is honest: it's the most boring node you'll install all week, and it'll still save you from retyping number lists. Just remember it makes a string, not a loop, and point your step the right way.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| start | INT | 0 | β |
| end | INT | 3 | β |
| step | INT | 1-999999β999999 | β |
| separator | STRING | , | β |
| mode | COMBO | 2 options: inclusive, exclusive |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | β |