CNPFormat
CNP Format is a ComfyUI custom node for building strings with printf-style placeholders.
Features
- Outputs a single
STRING - Uses a format string with placeholders such as
%s,%u,%d,%f, and%% - Auto-expanding argument inputs in the UI
- Accepts mixed input types through wildcard inputs
Example
Format:
Size: %u x %u | CFG: %.1f | Prompt: %s
Arguments:
arg_1 = 1024arg_2 = 1536arg_3 = 7.5arg_4 = "cinematic night city"
Output:
Size: 1024 x 1536 | CFG: 7.5 | Prompt: cinematic night city
Supported placeholders
%sstring%uunsigned integer style formatting%d/%iinteger%f/%e/%gfloat%x/%X/%ointeger formatting%ccharacter%%literal percent sign
Notes
- The node keeps one empty trailing input so users can continue attaching more arguments.
- If the format string requires more arguments than are connected, the node raises a readable error.
- Extra connected arguments beyond the placeholders are ignored.