ComfyUI Node

String Formatter

Construct the formatted string from template and format-dictionary.

By Lex-DRL·Created about a year ago·Updated 4 months ago· 4
String Formatter
  • dict
  • string
template
recursive_formatfalse
safe_formattrue
show_statustrue
CategoryString Constructor

Inputs (5)

NameTypeDefaultDescription
templateSTRINGType the text template. To reference named substrings from format-dictionary, use this syntax: {substring_name}. For example: score_9, score_8_up, score_7_up, {char1_short}, standing next to {char2_short}, {char1_long} {char2_long}
recursive_formatBOOLEANfalseDo recursive format - i.e., allow the chunks from the dictionary to reference other chunks.
safe_formatBOOLEANtrueIf template contains an invalid {text pattern} which can't be formatted - leave it as-is (instead of throwing an error). Safe mode is recommended for templates with JSON, CSS, or other literal curly brackets.
show_statusBOOLEANtrueShow the final string constructed from the text-template and format-dictionary?
dictoptDICTThe dictionary to take named sub-strings from. It could be left unconnected, if the pattern doesn't reference any sub-strings - then, this node acts exactly the same as a regular string-primitive node.

Outputs (1)

NameTypeDescription
stringSTRING