isdecimal
The pickiest number check of them all
- BOOLEAN
You'd think all number checks were the same. They aren't, and this is the strictest of the pack's three number tests - isdecimal, isdigit, isnumeric. For most people, isdecimal is the one that means what they think "is this a number" should mean.
What it does
isdecimal wraps str.isdecimal(). It returns True if every character is a decimal digit - the ordinary 0–9 and their Unicode decimal equivalents - and the string has at least one character. Superscripts, fractions, and Roman numerals all fail; even the string "²" returns False.
One string input, one BOOLEAN output.
The subtle difference that matters
This is where the family gets interesting. "²".isdigit() is True - it's a digit by Unicode's rules - but "²".isdecimal() is False, because it's not a decimal number you can use in arithmetic. So if you're about to cast a string to an integer and want to be sure the cast is safe, isdecimal is the conservative choice.
Also note what it is not: it's not a "is this a number" test. "1.5" is False (the dot isn't a digit), "-9" is False (the minus sign isn't a digit), and "999" is True. It checks digits-only, which is a stricter and often more useful property.
Why you'd reach for it
Validating that a string is a clean base-10 integer before you cast it or use it in math. Checking that an input is numeric-only before it becomes a key or a filename component. If you're distinguishing plain decimal text from fancy Unicode numerals, this is the node that draws that line.
Installing
Part of Basic data handling by StableLlama. In ComfyUI Manager search "Basic data handling" → Install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart. Zero runtime dependencies - pure stdlib - so the install is painless.
Where people get burned
Expecting it to validate actual numbers. It validates digit characters - a string that is a number in the formatting sense ("-9", "1.5") fails. If you want to know "can I safely cast this," chain isdecimal with the pack's cast-to-INT node and check the boolean first. And remember the empty string is False, which for validation is what you want.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |