Visit ComfyUI Online for ready-to-use ComfyUI environment
Versatile text string manipulation node for AI artists, offering append, replace, and tidy functions.
The StringFunction| String Function 🐍
node is a versatile utility designed to manipulate and transform text strings based on specified actions. This node is particularly useful for AI artists who need to dynamically modify text data within their workflows. It offers two primary actions: appending multiple text strings together or replacing parts of a text string using either direct substitution or regular expressions. Additionally, it includes an option to tidy up the resulting text by removing extra spaces and redundant commas, ensuring clean and readable output. This node simplifies text processing tasks, making it easier to manage and format text data efficiently.
The action
parameter determines the type of text manipulation to be performed. It accepts two options: append
and replace
. When set to append
, the node concatenates the provided text strings (text_a
, text_b
, and text_c
). When set to replace
, the node replaces occurrences of text_b
in text_a
with text_c
. If text_b
is formatted as a regular expression (enclosed in slashes), it performs a regex-based replacement. This parameter is required for the node to function correctly.
The tidy_tags
parameter specifies whether to clean up the resulting text by removing extra spaces and redundant commas. It accepts two options: yes
and no
. When set to yes
, the node will tidy up the text, ensuring a cleaner output. This parameter is required and helps maintain the readability of the output text.
The text_a
parameter is the primary text input for the node. It is used as the base text for both the append
and replace
actions. This parameter supports multiline text and does not allow dynamic prompts. It is optional but necessary for meaningful output.
The text_b
parameter serves as the secondary text input. In the append
action, it is one of the texts to be concatenated. In the replace
action, it specifies the text or regex pattern to be replaced in text_a
. This parameter supports multiline text and does not allow dynamic prompts. It is optional but crucial for the replace
action.
The text_c
parameter is the tertiary text input. In the append
action, it is one of the texts to be concatenated. In the replace
action, it specifies the replacement text for occurrences of text_b
in text_a
. This parameter supports multiline text and does not allow dynamic prompts. It is optional but necessary for the replace
action to define the replacement text.
The STRING
output parameter provides the resulting text after the specified action has been performed. This output contains the manipulated text, either concatenated or with replacements made, and optionally tidied up based on the tidy_tags
setting. The output is essential for further processing or display within your workflow.
action
parameter to append
and provide the desired texts in text_a
, text_b
, and text_c
./pattern/
) in the text_b
parameter and set the action
parameter to replace
.tidy_tags
parameter to yes
to automatically clean up the resulting text, removing extra spaces and redundant commas for a polished output.text_b
parameter is intended to be a regex pattern but is not correctly formatted.text_b
is enclosed in slashes (e.g., /pattern/
).action
or tidy_tags
) are not provided.action
and tidy_tags
parameters.replace
action is selected, but text_c
is not provided.text_c
is specified when using the replace
action to define the replacement text.© Copyright 2024 RunComfy. All Rights Reserved.