HandyBench

Add Prefix / Suffix to Lines

Add text to the start and end of every line.

How to use the Add Prefix / Suffix to Lines

  1. 1 Paste your list, one item per line.
  2. 2 Type the prefix to add at the start and the suffix to add at the end of each line.
  3. 3 Choose whether to skip blank lines, then copy the result.

What this tool does to each line

Every line becomes prefix + line + suffix. Nothing else is modified: the original text is not trimmed, and both strings are inserted literally, including any spaces you type. A single checkbox, "Skip empty lines", leaves lines that are empty or contain only whitespace untouched; it is on by default, so blank separators do not turn into stray ', fragments.

Recipes that work

GoalPrefixSuffixResult for the line red
Quoted, comma-separated values'','red',
JSON-style strings"","red",
HTML list items<li></li><li>red</li>
Markdown bullets- empty- red
Code comments// empty// red
Email quoting> empty> red
Indent with spacesfour spacesempty    red

Worked example: a SQL IN list

Paste three codes on separate lines (A100, B200, C300), use ' as the prefix and ', as the suffix, and the output is:

'A100',
'B200',
'C300',

The tool puts the suffix on every line, so the final line also ends in a comma. Delete that last comma by hand before pasting the list into WHERE code IN (...), or the query will fail with a syntax error. If you would rather have all the values on one line, join them afterwards with Remove Line Breaks.

Limits worth knowing

  • No escape sequences. Typing \t or \n in the prefix inserts a literal backslash and letter, not a tab or line break. To insert a real tab, paste a tab character into the field.
  • No escaping of the content. If a line already contains a quote or apostrophe, such as O'Brien, wrapping it in single quotes produces broken SQL or code. Escape those first with Find and Replace.
  • Different strings per line need another tool. The same prefix goes on every line; for a changing counter use Add Line Numbers.
  • A trailing empty line, from a final line break in your paste, is skipped by default; if you turn skipping off, it receives the prefix and suffix alone.

For working with spreadsheet exports, pair this with the CSV column extractor to pull a single column first, then wrap each value.

Examples

  • ▸ Wrapping each value in quotes and adding a trailing comma for code.
  • ▸ Turning a list into HTML <li> items.

Frequently asked questions

Can I use it to build a SQL "IN" list or array?

Yes. Set the prefix to a single quote and the suffix to ',' (quote-comma) to turn a plain list into quoted, comma-separated values.

Does it touch empty lines?

By default blank lines, including lines that contain only spaces, are left untouched. Turn off "Skip empty lines" if you want the prefix and suffix added to them too.

Why does the last line also get a comma?

The suffix is added to every line, including the last one. For a SQL IN list or a JavaScript array, delete the final comma by hand before using the result.

Can I add a tab or line break using \t or \n?

No. The prefix and suffix are inserted literally, so typing \t adds a backslash and the letter t. Paste a real tab character into the field if you need one.

What if my lines already contain quotes?

The tool does not escape anything, so wrapping O'Brien in single quotes gives broken code. Escape the quotes first using Find and Replace, or choose different wrapping characters.