String to Int
The one-line string-to-number cast that unblocks half your workflows
- integer
Here's a ComfyUI annoyance that eats whole afternoons: some nodes hand you numbers as text, and the sampler needs an actual INT. Seeds, step counts, batch sizes - if they arrive as strings, nothing you wire them into will accept them. String to Int is the two-second fix: one string in, one INT out. It's the most boring node in this pack and also one of the most quietly load-bearing.
How it works
One input, string (a plain field defaulting to "0"), one output, integer. It runs Python's int() on the text. That's the whole mechanism, and its behavior is exactly what int() gives you:
"42"→42"-7"→-7" 12 "→12(whitespace is trimmed)
And critically, what it does not do: it won't parse floats - "3.7" fails - and it won't parse strings with stray text like "42abc". When int() fails, the node returns 0 rather than raising an error. That's the part to internalize: garbage in, zero out, silently.
Where you'd use it
Anywhere a number is hiding inside a string. Parse a seed out of a filename before feeding a sampler. Take a step count that some utility node emitted as text and hand it to a scheduler. Read a value out of a JSON parser (a frequent source of numeric-looking strings) and cast it before it reaches a widget that demands a real integer.
It's one of the pack's casting family - String to Float, Float to Int, and the reverse casts live alongside it under 🐝TinyBee/Casting - so when text→number is the problem, the family has you covered in both directions.
Install
This node ships in ComfyUI-TinyBee. ComfyUI Manager → search ComfyUI-TinyBee → install → restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
Restart and it's under 🐝TinyBee/Casting. Pure Python stdlib - no models, no extra packages. The pack's pillow/jsonata requirements don't apply to this node.
Gotchas
The silent-zero behavior is the trap, and it's subtle because it's friendly: if you feed it "3.7" or "42abc", you don't get an error - you get a 0 that flows quietly downstream and produces nonsense output you'll chase for an hour. If your source text can contain non-integer content, validate it before the cast. And if the string is a float, String to Float (then Float to Int if you need it) is the correct path, not this node. Nothing is magic; it's int(), and int() is strict.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| integer | INT | — |