Text/Clean

Add text to the start and end of lines

Adds a given string to the start and end of every line.

Example

  • Options used
  • Prefix<li>
  • Suffix</li>
Input
apple
banana
cherry
Output
<li>apple</li>
<li>banana</li>
<li>cherry</li>

Symbols in examples: ⇥ tab · · trailing space · ⍽ NBSP · □ full-width space · ◌ zero-width character

Open this operation in the tool

What it does

Adds the 'Prefix' to the start of every line and the 'Suffix' to the end. You can use just one of them. \t and \n are interpreted as a tab and a line break.

Options

  • Skip blank lines: on by default, so nothing is added to blank lines.

Common combinations

  • Markdown list: prefix -
  • Blockquote: prefix >
  • SQL string values: prefix ', suffix ' → then Remove line breaks (join into one line) with the separator ,
  • JSON array items: prefix ", suffix ",
  • HTML list: prefix <li>, suffix </li>
  • Hashtags: prefix #

Caution

If a value already contains the same quote character you are adding, the result breaks. For SQL, first use Find and replace to turn ' into ''. Tidying spaces with Trim leading and trailing spaces before adding text prevents mistakes like ' value ', where spaces end up inside the quotes.