Cadmeo

Prefix and Suffix Adder

Result

'apple', 'banana', 'cherry',

The prefix and suffix adder wraps every line in text you supply. It is the fastest way to turn a plain list into quoted CSV values, an SQL IN clause, a set of HTML list items or a JavaScript array. Anything where each line needs the same thing before and after it.

How it works

Each line is treated independently. Empty lines can be skipped, which matters when the wrapper adds visible characters. Wrapping a blank line in quotes produces an empty string entry that was never in your data.

  • Prefix and suffix are both optional; using only one is common.
  • Line breaks are preserved, so the structure of the list survives.
  • Nothing is escaped. A value containing your suffix character will produce broken output, which is a real risk when quoting.

Examples

Building an SQL IN clause

Lines

apple
banana
cherry

Prefix

'

Suffix

',

Result

'apple',
'banana',
'cherry',

Remove the final comma by hand. Adding it conditionally to all but the last line would be a different tool.

HTML list items

Prefix

<li>

Suffix

</li>

Result

<li>apple</li>
<li>banana</li>
<li>cherry</li>

Nothing is HTML-escaped, so a line containing an angle bracket produces markup you did not intend.

Frequently asked questions

Does it escape quotes inside my values?

No. If a line contains an apostrophe and you wrap it in apostrophes, the result is broken SQL. That is a genuine limitation. Escaping correctly depends on the target language, and guessing wrong is worse than not trying.

Why is there an option to skip empty lines?

Because wrapping a blank line produces a visible artefact (an empty quoted string, or an empty list item) that was not in your data. Skipping them is on by default for that reason.

How do I remove the trailing comma from the last line?

By hand, or by editing the last line after copying. Conditional formatting of the final item is a different problem, and building it in would make the tool harder to reason about for the common case.

Can I add a prefix without a suffix?

Yes, leave the suffix empty. Adding "> " as a prefix is a quick way to quote a block of text for email or Markdown.