段落每行添加前后缀🐠meeeyo.com
Prefix and suffix every line of a block — formatting lists in bulk
- STRING
AddPrefixSuffixToLines is the bulk version of AddPrefixSuffix: instead of wrapping one string, it wraps every line of a multi-line block with the same prefix and suffix, and rejoins them. One multiline input, one string in, one string out. It's the node for the moment when you have a raw list of tags or prompts and need to format the whole list at once.
The classic use: you have a list of subjects on separate lines and you want each one turned into a full prompt fragment - a photo of a cat, a photo of a dog. Set the prefix to a photo of and the suffix to ``, and the whole block transforms in one shot. It also handles the opposite direction: taking a tag list and wrapping each line in comma-separated prompt syntax, or reformatting a bulleted block into plain lines.
The inputs
- input_text - the multiline block. Every non-empty line gets wrapped.
- prefix_suffix - a single field containing both values, separated by
|: prefix on the left, suffix on the right. The default前缀符|后缀符is the Chinese placeholder pair - replace it with your actual strings, e.g.a photo of |.
One field for two values is the pack's convention (you'll see the same prefix|suffix pattern in other Meeeyo nodes), and it keeps the node compact. The split happens on the first |, so a prefix that contains a literal pipe is not going to work.
The gotcha that bites
If prefix_suffix has no | at all, the node silently returns an empty string. No error, no hint - just an empty output. The author caught the ValueError and decided an empty result was the graceful response. If your output suddenly vanishes, check that your prefix/suffix field still has its pipe. Similarly, blank lines in the input become empty wrapped lines, which usually look like noise on the way out.
Also note the asymmetry with its sibling: AddPrefixSuffix wraps the whole input once; this node wraps each line. They're easy to confuse at a glance, and reaching for the wrong one is the most common "why is this not doing what I expect" moment in this pair. Need both levels of wrapping? Chain them - line-wrap first, then wrap the whole block.
Where it earns its keep
Any workflow that treats prompt lists as data. Prepend quality framing to every candidate in a batch, reformat a word list into comma-delimited prompt syntax for a CLIP encoder, or add consistent markers to every line of a structured block before ExtractSpecificLines pulls them apart by index. It's deterministic and instant - pure string work.
Installing
The usual pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
or via ComfyUI Manager searching ComfyUI_StringOps, then restart. Under "Meeeyo/String". No models, no extra dependencies.
A small node with one genuine footgun (the missing-pipe empty output). Once you know that, it's a reliable way to reformat whole prompt banks in a single step.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input_text | STRING | — | |
| prefix_suffix | STRING | 前缀符|后缀符 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |