Text Operations

In ComfyUI, text is mainly handled as prompts. Automating some operations, such as replacing part of a string or attaching trigger words to prompts created by LLMs, makes the workflow more convenient.
What is a string?
In the programming world, text is called string to distinguish it from numbers and the like.
apple→ 5-character string123→ Looks like a number, but is actually a string treated as text" "(Space) → Invisible, but a 1-character string
Basic Operation Nodes
String Node (Text Input)

This is a basic node for entering character strings. Using the String (Multiline) node allows you to enter text containing line breaks.
Concatenate Node (Text Joining)

Combines multiple strings into one.
(Example: apple + pen → applepen)
delimiteris a separator character. You can use whatever you like (comma, line break, etc.).
Replace Node (Text Replacement)

Replaces specified characters with other characters.
(Example: apple pen → orange pen)
Substring Node (Text Extraction)

Extracts characters in a specified range.
(Example: apple → ppl)
- Extracts the string from the
startth to theendth character.
Trim Node (Remove Spaces)

Removes spaces before and after the string.
(Example: apple → apple)
- It is plain but important because it prevents errors caused by unintended spaces in user input etc.
Length Node (Character Count)

Counts the length of the text.
(Example: apple → 5)
- Spaces and line breaks are also counted as 1 character.
- The output will be int type (number).
Advanced Operations (Regular Expressions)
Performs complex searches and replacements using a description rule called "Regular Expression (Regex)".
Regex Extract Node

Extracts strings that match the condition using regular expressions.
Regex Replace Node

Replaces strings that match the condition using regular expressions.
Power Puter (rgthree)
The Power Puter from rgthree-comfy used in Simple Math can also input/output strings, so you can manipulate strings flexibly including the text processing mentioned above.
