About the Add Prefix and Suffix to Lines
A column of values copied out of a spreadsheet is rarely in the shape the next system wants. Wrapping each one in quotes for a SQL IN clause, in <li> tags for a page, or behind a directory path for a build script means typing the same two strings hundreds of times. Set a prefix and a suffix here and every line gets both in a single pass.
The prefix goes at the very start of the raw line, ahead of any indentation the line already carries, and the suffix at the very end, after any trailing spaces. When the source is indented or right-padded, run Trim Lines first or the wrapper ends up in the wrong place. Blank and whitespace-only lines are skipped, so the grouping of a list is preserved rather than filled with stray quote marks.
The usual trap is the separator. Setting the suffix to a comma leaves a comma on the last line too, which most parsers reject, so that one still needs deleting by hand. To number the lines rather than wrap them, use Number Lines; to strip a wrapper that is already in place, a short pattern in Find and Replace does it.
How to use
- Paste the list.
- Set the prefix and suffix.
- Copy the result.
Common questions
- Are blank lines given the prefix?
- No, empty lines are skipped so the list structure is preserved.
- How do I wrap each item in quotes?
- Set both prefix and suffix to a quote character.
- Can I add a comma to every line?
- Set the suffix to a comma. Remove the last comma by hand, or use Join Lines to build a proper list.