ComfyUI Node

Formatted String

Creates a string that contains placeholder variables and replaces them with their respective values. Uses python `str.format()` internally, see [Python - Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax) . * You can use `{a:.2f}` to round off a float to 2 decimals. * You can use `{a:05d}` to pad up to 5 leading zeros to fit with comfys filename suffix `ComfyUI_00001_.png`. * If you want to write `{ }` within your strings (e.g. for JSONs) you have to double them: `{{ }}`. Also applies *search & replace (S&R) syntax* such as `%date:yyyy-MM-dd hh:mm:ss%` and `%KSampler.seed%`. Thus you can also use it as a `GET-node`. Note that "search & replace" takes place in Javascript context and runs before node execution.

By geroldmeisinger·Created 9 months ago·Updated 6 months ago· 169
Formatted String
  • a
  • b
  • c
  • d
  • string
fstring{a}_{b}_{c}_{d}
CategoryUtility

Inputs (5)

NameTypeDefaultDescription
fstringSTRING{a}_{b}_{c}_{d}Creates a string that contains placeholder variables and replaces them with their respective values. Uses python `str.format()` internally, see [Python - Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax) . * You can use `{a:.2f}` to round off a float to 2 decimals. * You can use `{a:05d}` to pad up to 5 leading zeros to fit with comfys filename suffix `ComfyUI_00001_.png`. * If you want to write `{ }` within your strings (e.g. for JSONs) you have to double them: `{{ }}`. Also applies *search & replace (S&R) syntax* such as `%date:yyyy-MM-dd hh:mm:ss%` and `%KSampler.seed%`. Thus you can also use it as a `GET-node`. Note that "search & replace" takes place in Javascript context and runs before node execution.
aopt*(optional) value that will be as a string at the `{a}` placeholder.
bopt*(optional) value that will be as a string at the `{b}` placeholder.
copt*(optional) value that will be as a string at the `{c}` placeholder.
dopt*(optional) value that will be as a string at the `{d}` placeholder.

Outputs (1)

NameTypeDescription
stringSTRINGThe formatted string with all placeholders replaced with their respective values.