ATOI
String to integer, with zero mercy for bad input
- integer
This is the most boring node you'll ever install, and you'll be glad it's there the day you need it. ComfyUI is full of places that want an INT - a seed, a step count, a batch size, a resolution parameter - while a surprising number of things upstream hand you numbers as text: a parsed filename, a value out of a CSV, a string from another node. ATOI ("ASCII to integer," if anyone still says that) is the bridge.
What it does
One input, one output. Takes a STRING like "42" and returns the INT 42. That's the entire node - the source is literally return (int(text),).
How it works and where it bites
It's Python's int() conversion, and that's the part worth knowing because int() is strict:
"42"→42✅" 42 "→42(leading/trailing whitespace is tolerated) ✅"4.2"→ crashes.int()won't round or truncate; a decimal string is not an integer string."42abc","four",""→ crashes.
There's no fallback, no error handling, no "parse the digits and drop the rest." Feed it anything that isn't a clean integer string and the run dies with a ValueError. That's actually fine for a utility node - you want to know your upstream is handing you garbage - but it means ATOI is not a place for tolerance.
Input: text (STRING, typeable - no forceInput here).
Output: integer (INT).
How to install it
Part of exectails/comfyui-et_stringutils ("String Utils"). Via ComfyUI Manager, search "String Utils", or:
cd ComfyUI/custom_nodes
git clone https://github.com/exectails/comfyui-et_stringutils
Restart ComfyUI; it appears under exectails/Strings. The pack has no dependencies and downloads nothing - a single clone and you're done.
Common issues
The one real failure mode is feeding it a non-integer string and getting a hard error. If you're parsing something with decimals, either clean the text first (the pack's Text Replacer can strip ".5" off), or reconsider - for float-to-text you actually want FTOA, and for the reverse trip from an INT back to a string you want ITOA, both in this same pack. ATOI + ITOA make a tidy round trip if you ever need to pass a number through something that only speaks text.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| integer | INT | — |