AGSoft Text Operation
Ten text transforms in one dropdown — and one of them hands you a number
- text
- count
- lines
If you've ever chained three text nodes just to uppercase a prompt, this is the node you were looking for. AGSoft Text Operation from the comfyui-AGSoft pack stuffs ten everyday string transforms into a single dropdown, and it throws in a couple of outputs that let the result feed logic downstream. It's the text-workflow equivalent of a leatherman: you won't use every blade, but the one you need is always there.
What it actually does
Two inputs, that's it: a text field (multiline, so paste whole paragraphs) and an operation dropdown. Under the hood it's plain Python string handling - no models, no deps, nothing to break:
uppercase/lowercase/capitalize- the obvious ones.capitalizefollows Python semantics: only the first character of the whole string gets capitalized, not the first letter of each word. If you want title case, this isn't it.invert_case- flips every character, lower becomes upper and vice versa.reverse- mirrors the whole string, so "abc" → "cba". Great for making your prompt unintelligible; occasionally useful for real.trim- strips leading/trailing whitespace.remove_spaces- nukes all whitespace, including tabs and newlines, not just spaces. Handy when a model's tokenizer chokes on stray whitespace.count_words- counts words via a regex over non-whitespace runs and writes the number to thecountoutput.split_lines- normalizes line breaks (handles\r\ntoo) and puts the cleaned lines into thelinesoutput.join_lines- flattens multiline text into a single line, which is what you want before feeding a prompt into a CLIP encoder.
The outputs that matter
The node always returns three sockets even though not every operation uses them:
text(STRING) - the transformed string. Forcount_wordsandsplit_linesit passes the original text through untouched, so downstream wiring doesn't break.count(INT) - only meaningful aftercount_words. You can wire this into a comparison node to gate a workflow, e.g. skip sampling if the prompt is under a word count.lines(STRING) - only populated bysplit_lines.
Where you'd reach for it
The boring-but-real use: clean up a prompt before it hits the encoder. Some models respond better to specific casing, and batching a folder of prompts with inconsistent whitespace/case is exactly the fiddly job this kills. Pair it with a Show Text node to eyeball the result while you iterate. Because the input field supports dynamic prompts, it slots neatly into wildcard-heavy workflows too.
Installing it
Same story as the rest of the pack - it ships inside comfyui-AGSoft, a big Russian-authored utility pack with bilingual docs (you'll see the RU/EN tooltips). Install the pack once and every AGSoft node comes with it:
cd ComfyUI/custom_nodes
git clone https://github.com/Art-xmaster/comfyui-AGSoft.git
# restart ComfyUI
Or search comfyui-AGSoft in ComfyUI Manager and click install. No model downloads, no heavy dependencies - this node is pure standard library, so the pack's numpy/opencv-python/translators requirements don't even apply to it.
Gotchas
Honestly, there aren't many - it's stdlib string code, so there's basically nothing to break. The two traps are both "read the docs" traps: capitalize isn't title case, and remove_spaces is more aggressive than the name implies. If you pick count_words and see the count socket sitting at zero, check for an empty string - empty text returns 0 by design. Otherwise, this is the rare node that just works.
One more thing worth knowing about the pack in general: its loader scans every .py file and imports them all, logging per-module failures without killing ComfyUI. So if an AGSoft node you expected is missing from the menu, glance at the console log - a sibling module may have failed to import while this one loaded fine.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | The text to apply the operation to. This is the source string that will be modified. Текст, к которому будет применена операция. Это исходная строка, которая будет изменена. | |
| operation | COMBO | uppercase | Select the operation to perform on the input text. Выберите операцию, которую нужно выполнить над входным текстом. - uppercase: Converts all characters to uppercase. Преобразует все символы в верхний регистр. - lowercase: Converts all characters to lowercase. Преобразует все символы в нижний регистр. - capitalize: Capitalizes the first letter of the entire string. Делает первую букву всей строки заглавной. - invert_case: Inverts the case of each character (upper becomes lower and vice versa). Инвертирует регистр каждого символа (верхний становится нижним и наоборот). - reverse: Reverses the order of characters in the string. Переворачивает порядок символов в строке. - trim: Removes leading and trailing whitespace (spaces, tabs, newlines) from the string. Удаляет начальные и конечные пробельные символы (пробелы, табуляции, переводы строк) из строки. - remove_spaces: Removes ALL whitespace characters (spaces, tabs, newlines) from the string. Удаляет ВСЕ пробельные символы (пробелы, табуляции, переводы строк) из строки. - count_words: Counts the number of words in the text. The result is output to the 'count' socket. Подсчитывает количество слов в тексте. Результат выводится в сокет 'count'. - split_lines: Splits the text into lines and outputs them as a single string joined by newlines. Useful for processing multi-line text. Разбивает текст на строки и выводит их как одну строку, соединенную символами новой строки. Полезно для обработки многострочного текста. - join_lines: Joins all lines of the text into a single line, separated by a space. Useful for flattening multi-line text. Объединяет все строки текста в одну строку, разделенные пробелом. Полезно для сглаживания многострочного текста. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| count | INT | — |
| lines | STRING | — |