Add Prefix / Suffix to Lines
Wrap every line with text of your choice before and after it, such as quotes and a comma, with options to trim, skip blank lines and number the lines.
Use the tool
Why this tool exists
Turning a column of names into a quoted array, a list of IDs into SQL fragments or a list of words into HTML items is one of those chores that a text editor macro would handle but that you rarely have the macro for. A regular expression works, but it takes longer to write than the task deserves.
Put your prefix and suffix in the boxes and paste the lines. Typical pairs are a double quote and a quote with a comma, or an opening list tag and its closing tag. Use {n} in either box to insert the line number when the numbering option is on. Trim removes stray spaces first and skip drops blank lines, so empty rows do not become empty quoted entries.
How to use it
- Paste your lines.
- Type a prefix and a suffix, and choose whether to trim lines and skip empty ones.
- Tick numbering to replace {n} with the line number, then copy the result.
Frequently asked questions
How do I make a quoted, comma-separated list?
Use a double quote as the prefix and a double quote plus a comma as the suffix. Remove the final comma by hand, since the tool treats every line the same way.
How does numbering work?
With numbering on, every {n} in the prefix or suffix becomes the running number of the line, counting only the lines that are kept. Use it for things like numbered steps.
What happens to blank lines?
When skipping is on, empty lines are removed after trimming. When it is off they stay and still receive the prefix and suffix.
Can I add text only on one side?
Yes. Leave either the prefix or the suffix box empty and the other one still applies to every line, so you can add just a bullet or just a trailing comma.