text_add_prefix_suffix
Add a fixed prefix and/or suffix to every line, word, or character of text. Use for wrapping, indenting, quoting, or tagging multiple elements at once.
Instructions
Add Prefix And Suffix To Text. Add a prefix string, a suffix string, or both around every line, every word, or every character of the supplied text, choosing the granularity with targetType (lines, words, or characters). Use text_add_prefix_suffix to wrap, indent, comment out, quote, or tag many elements at once; use text_add_line_numbers instead when you need sequential numbering rather than a fixed repeated affix, and text_joiner when you need to concatenate separate elements with a separator. Runs locally on the text you provide: read-only, non-destructive, contacts no external service, and is rate-limited (60 requests/minute for anonymous callers). Returns the transformed string plus before/after statistics and the effective options.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Text to transform. Must not be blank; a blank value returns a 400 error. | |
| prefix | No | String prepended to each target element. Empty string adds no prefix. | |
| suffix | No | String appended to each target element. Empty string adds no suffix. | |
| targetType | No | Granularity of the affix. lines wraps each newline-separated line, words wraps each whitespace-separated word (whitespace preserved), characters wraps each character. Any other value returns the text unchanged. | lines |
| skipEmpty | No | When true, blank lines or words are left untouched. Ignored for the characters target. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Whether the transformation succeeded. | |
| result | No | The transformed text with prefixes and/or suffixes applied. | |
| stats | No | Before and after counts plus a record of what changed. | |
| options | No | The effective options after defaults were applied. |