ConvertStringToNumber(NYJY)
Turn a text number into actual INT and FLOAT wires
- INT
- FLOAT
The number you need often starts life as text - an LLM wrote "4" in its answer, a JSON value came back quoted, a filename contains the batch size. But ComfyUI's inputs demand real INT or FLOAT types, and pasting a string into a step field won't fly. ConvertStringToNumber is the bridge: give it a STRING that represents a number, and it hands you both an INT and a FLOAT output, so you can wire whichever type the downstream node wants without a second thought.
How it works
Straightforward: int(input) for the INT output and float(input) for the FLOAT output. Python's own parsing rules apply, which is where the sharp edges live. "4" → 4 int / 4.0 float. "3.7" → the float output is 3.7, but the int output is... an error, because int("3.7") throws. "3.5" similarly. A leading "4.0" fails the int path too. So the practical rule: if your string might have a decimal point, treat this node as a float source and let the INT output go unused - or keep the string integer-only if you need the int side.
Inputs and outputs
- input - required STRING. The text version of a number.
- Outputs: INT and FLOAT - the same value parsed two ways, both always emitted together.
Installing
Standard pack install: ComfyUI Manager → Install via Git URL → https://github.com/aidenli/ComfyUI_NYJY, restart. No extra dependencies for this node beyond the pack.
The one trap that bites
The decimal-point crash above is the whole failure mode, and it's a silent one - the node throws rather than rounding. If you're parsing LLM output or JSON, sanitize first (trim whitespace, strip quotes) and know what shape the number is in before you trust the INT output. And a companion note: there's no error return here - a bad parse fails the node, so keep your input clean. In practice, the pairing that works well in this pack is: an LLM node (BailianChat, CommonLLMChat) writes a number, this converts it, and the FLOAT output drives a sampler parameter or a slider's value. It's a small utility, but it's exactly the kind of glue that turns "the AI wrote a number in text" into "the workflow actually used it."
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |
| FLOAT | FLOAT | — |