Add Prefix / Suffix

Add custom text before and after each non-empty line.

Ready.
v1.0
About this tool

Add Prefix / Suffix

Add Prefix / Suffix puts custom text at the start of every line, the end of every line, or both. It turns a plain list into formatted output in one step.

How to use it

  1. Paste your list, one item per line.
  2. Enter a prefix, a suffix, or both.
  3. Copy the result.

What this is really for

Most uses are about converting a plain list into some syntax. Wrapping each line in quotes and a comma turns a column of values into an array literal. Adding a hyphen and a space turns it into a Markdown list. Adding a tag turns it into HTML.

It is the fastest path from data you have to the format something else demands, without writing a script or reaching for a spreadsheet formula.

Worked example

Turning a list of IDs into a SQL clause:

  • Prefix'
  • Suffix',
  • Input lineA123

Result: 'A123', which pasted together forms the body of an IN clause.

When it helps

  • Quoting a list of values for code or SQL.
  • Turning a plain list into Markdown bullets.
  • Wrapping lines in HTML tags.
  • Adding a common path or domain to a list of filenames.

Common mistakes

  • Forgetting the last line still gets the suffix, so a trailing comma may need removing by hand.
  • Adding quotes to values that already contain quotes, which needs escaping rather than wrapping.
Add Prefix / Suffix interface preview
Screenshot of the live Add Prefix / Suffix interface.