Nodes/String Utils/Text Formatter (5 Arguments)
ComfyUI Node

Text Formatter (5 Arguments)

The middle child that's usually the right size

By exectails·Created 2 years ago·Updated 7 months ago· 3
Text Formatter (5 Arguments)
    • text
    format
    arg0
    arg1
    arg2
    arg3
    arg4

    Two arguments feels tight for a real prompt. Ten arguments looks like a plate of spaghetti. Five - five is where most prompt templates actually live: subject, style, camera, lighting, mood, and you've still got a slot to spare. Text Formatter (5 Arguments) is the middle sibling of the pack's formatter family and, for most people, the one they end up keeping.

    What it does

    Same deal as the 2-argument version in this pack, just with more slots. A format template plus five string arguments (arg0 through arg4) produces one output string via Python's str.format(). The README pattern applies directly: format "A {arg0} portrait of {arg1}, {arg2} lighting, shot on {arg3}, {arg4}" - wire in a subject, a character, a lighting choice, a camera, a mood, and the node assembles the finished prompt.

    This is where the formatters stop being a convenience and start being a workflow pattern: the template stays fixed, the inputs come from wherever your graph decides, and you can change one slot (swap arg3 from "35mm" to "cinestill 800t") without touching the sentence.

    How it works

    format.format(arg0=..., arg1=..., arg2=..., arg3=..., arg4=...), called with named arguments. Two rules that will bite you exactly once each:

    • Placeholders must be named - {arg0} through {arg4}. Positional {} won't pick anything up.
    • Referencing a slot the node doesn't have (writing {arg5} here) throws a KeyError. This node only knows five names.
    • Unused slots are fine - a template using only {arg0} and {arg2} works; the extras are ignored.
    • Literal braces need doubling: {{ and }}.

    Inputs:

    • format - the template. Multiline, the one thing you type.
    • arg0arg4 - STRING inputs, all forceInput. No text boxes: wire values in from other nodes (Primitive, converters, Split Text, whatever produces them).

    Output: text, a single STRING for your prompt encoder.

    How to install it

    Part of exectails/comfyui-et_stringutils ("String Utils"). ComfyUI Manager → search "String Utils", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/exectails/comfyui-et_stringutils
    

    Restart, and the whole formatter family sits under exectails/Strings. Zero dependencies, zero model downloads - the install is the least interesting part of this node.

    Common issues

    The classic error is the KeyError from overreaching a placeholder - if your template says {arg5}, either trim the template or step up to the 10-argument sibling. The other one is the forceInput surprise: beginners stare at arg0–arg4 and see sockets, not text boxes, and assume the node is broken. It isn't - feed it values over wires. And remember this is a string formatter: if you want to inject a number, route it through ITOA or FTOA in this same pack first, because str.format can't pad or round a value you hand it as text.

    Categoryexectails/Strings

    Inputs (6)

    NameTypeDefaultDescription
    formatSTRING
    arg0optSTRING
    arg1optSTRING
    arg2optSTRING
    arg3optSTRING
    arg4optSTRING

    Outputs (1)

    NameTypeDescription
    textSTRING