swapcase
The Case-Flipping Node You'll Use Once (and Enjoy)
- STRING
Let's be honest: swapcase is not a node you'll reach for every day. It flips every character's case - uppercase to lowercase, lowercase to uppercase - so "Hello World" becomes "hELLO wORLD". It's the string equivalent of a party trick. But this pack ships the whole Python string toolkit, and when you actually need to flip case, you need a node for it, not a workaround.
How it works
A straight pass-through to Python's str.swapcase(), from StableLlama's Basic data handling pack. One input - string - and one output, STRING. There's no configuration to get wrong because there's no configuration at all. This is as thin as a node gets: string in, case-flipped string out.
It's worth noting the distinction from the other case nodes in the same pack: upper makes everything uppercase, lower makes everything lowercase, title makes words start uppercase, and swapcase reverses whatever case is there. Swapcase is the only one that doesn't assume a target - it just inverts. Feed it lowercase text and you get ALL CAPS. Feed it ALL CAPS and you get lowercase.
When would you actually use it
Honest use cases are narrow but real:
- Restoring mangled text - if you've got a dataset or API response that was accidentally case-swapped somewhere upstream, this undoes it.
- Data normalization experiments - flipping case is sometimes the cheap way to test whether a downstream process (tag matching, filename routing) is case-sensitive.
- Deliberately stylized output - generating "aesthetic" case for a filename or text overlay, if that's your vibe.
For anything that means "make this uppercase" or "make this lowercase," use the dedicated nodes instead. Swapcase is for the niche moment.
Installing it
Search "Basic data handling" in ComfyUI Manager and restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart and it's live. Zero dependencies, zero downloads - the whole pack is pure Python.
Gotchas
Python's swapcase has some Unicode corner cases - it can change more than ASCII case for certain characters. For plain-English workflow data it's predictable; for exotic Unicode, don't assume the round-trip (swapcase twice) is a perfect identity. It almost always is; it just isn't guaranteed.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |