Visit ComfyUI Online for ready-to-use ComfyUI environment
Interpolate strings with input variables to create dynamic text templates efficiently.
The Apply Text Template (mtb) node is an experimental utility designed to interpolate strings using input variables. This node allows you to create dynamic text by embedding placeholders within a template string, which are then replaced with corresponding values provided as inputs. This functionality is particularly useful for generating customized messages, labels, or any text-based content where variable data needs to be inserted into a predefined format. By using simple curly braces {}
to denote placeholders, you can easily define and manage your text templates, making your workflow more efficient and flexible.
The template
parameter is a string input that serves as the base text containing placeholders for variable interpolation. These placeholders are denoted by curly braces {}
, and each placeholder will be replaced by the corresponding value provided in the input. This parameter supports multiline text, allowing for complex and lengthy templates. The default value is an empty string. For example, a template could be "Hello, {name}
! Today is {day}
."
The string
output parameter is the resulting text after all placeholders in the template have been replaced with their corresponding values. This output provides the final interpolated string, which can be used directly in your project for display, logging, or further processing. The output is a single string that reflects the dynamic content generated based on the input variables.
© Copyright 2024 RunComfy. All Rights Reserved.