AIHub Utils Str To Float
The cast node that turns a selection string into a number
- FLOAT
AIHubUtilsStrToFloat is the type-conversion workhorse of the otavanopisto ComfyUI-aihub-workflow-exposer utils, and it does one thing: "0.0" → 0.0. A string in, a float out. In the AIHub world that matters because so many of the pack's controls are strings - AIHubExposeStringSelection hands you a string, file paths are strings, project metadata is strings. But the KSampler wants a cfg as a float, a denoise as a float, and so on. This node is the adapter.
The README's example shows the pattern: a string selector lets the user pick a video resolution ("landscape" / "portrait"), which is really a stand-in for numeric values. This node (paired with its siblings AIHubUtilsFloatToInt and AIHubUtilsStrToVector) is how those string choices become numbers your graph can use.
The one input, the one output
- value (STRING) - the text to parse, default
"0.0". - FLOAT - the parsed number.
The source wraps Python's float() in a try/except and raises a clear ValueError: Could not convert string to float on bad input. So "3.5" → 3.5, "25" → 25.0, and "abc" → a hard error, not a silent zero. That last point is actually a feature in a workflow that receives strings from a client: garbage surfaces as a visible error instead of corrupting the sample with a 0.0 cfg.
When you'd reach for it
The canonical spot is right after a string selection whose options are numeric-ish. If AIHubExposeStringSelection outputs "7.0", "7.5", "8.0" for a cfg choice, this node converts the pick into the float a KSampler needs. It's also useful for reading numeric values out of project metadata or a filename - anywhere a string carries a number and a downstream port insists on a float.
Gotchas
Two things worth knowing. First, it's strict: leading/trailing whitespace is fine, but anything non-numeric errors - so if your selection options aren't cleanly parseable, fix the options rather than the node. Second, remember it's a float: if the destination port wants an integer (seed, width), you still need AIHubUtilsFloatToInt after this. It's a cast, not a converter-to-anything.
Install
No requirements, like the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
Restart ComfyUI. It's a one-liner wrapped in error handling, and that's fine - in a workflow driven by client-supplied strings, the explicit cast with a loud failure is exactly the behavior you want.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | STRING | 0.0 | The string to convert to a float |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |