🐟String Converter
Turn text into ints, floats, booleans, lists, or dicts
- value
ComfyUI's type system is the glue that keeps workflows honest - a number wire only plugs into a number socket. But the real world hands you text: an LLM returns "42" as a string, a workflow JSON stores settings as text, a file path carries a numeric suffix. 🐟String Converter is the tiny adapter that turns a string into an actual typed value so the rest of your graph will talk to it. Boring, yes. Occasionally the exact thing that unsticks a workflow, also yes.
What it does
Two inputs: input_string (the text) and target_type, an enum with five options - INT, FLOAT, BOOL, LIST, DICT. It converts and hands you one output, value, typed as whatever you asked for (the output is *, so downstream nodes see an int, float, bool, list, or dict respectively).
The conversions are mostly what you'd expect from Python:
INT-"123"→123. It even runs it through a float step first, so"3.7"→3.FLOAT-"123.45"→123.45.BOOL- the friendly one:"true","1","yes","y","on"(any casing) →True; everything else →False.LIST- splits on commas and strips whitespace:"a, b, c"→["a", "b", "c"]. An empty string gives you an empty list.DICT- parses the input as JSON:'{"name": "test"}'→ a real dict.
The part that's actually good
Failure is loud. A bad conversion raises an exception with a message like [String Type Converter] Error converting 'abc' to INT: ..., which in ComfyUI shows up as an error on the node and stops the run. There's no silent default value, no "returns empty string on failure" - the pack's StringMatcher node will do the lenient thing if you need a fallback; this node is for when you need to know something converted correctly.
That strictness is the right design for wiring LLM output into samplers and numeric nodes. When a model hands back "steps=28" as free text and you need an actual integer for a KSampler, you don't want a silent 0 slipping through - you want the run to stop and tell you.
Installing
ComfyUI Manager, search "ComfyUI-String-Helper", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/liuqianhonga/ComfyUI-String-Helper.git
The pack's dependencies are just translators and chardet - and this node uses neither, so it's pure Python stdlib. If you're only after the converters and matchers in this pack, you can even ignore the translation deps; ComfyUI will install them anyway since they're in requirements.txt, but they're tiny.
When you'd actually reach for it
The killer combo is StringMatcher → StringConverter: match a condition, convert the resulting value to a number, feed it into a sampler or a scheduler. Or parse an LLM's JSON reply into a dict and index into it. It's not a node you'll use every day - it's a node you'll suddenly need when a workflow decides everything downstream has to be a string and you know better.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input_string | STRING | — | |
| target_type | COMBO | 5 options: INT, FLOAT, BOOL, LIST, DICT |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | * | — |