Developer Lists

Add prefix to lines

What to do

Transformed in your browser · nothing is uploaded

Local · blank lines dropped, not prefixed
Advertisement
320 × 100

Puts the same text at the front of every line, or at the end, or turns the lines into a bullet list. Blank lines are dropped rather than being given a prefix with nothing after it, and indentation survives; the prefix goes in front of it rather than replacing it.

How to use the add prefix to lines

1 Paste your lines.
2 Type what to add. "- " for a bullet, "> " for a quoted reply, an apostrophe for a quoted value.
3 Choose prefix, suffix or bullet list.
4 Run it twice, once each way, to wrap every line at both ends.

This is the small piece of plumbing that turns a pasted column into whatever format the next thing wants: a Markdown bullet list, an email reply quoted with >, a SQL IN clause of quoted values, a set of CSS class names. Doing it with find and replace on the line break almost works and then does not: replacing every break with a break plus your prefix misses the first line, and the same trick for a suffix misses the last, because that line has no break after it. An operation that works on lines rather than on the characters between them has no ends to get wrong.

The field keeps exactly what you type, spaces included, and the space is usually the point: - item is a bullet in Markdown and -item is not. To build a quoted list, run an apostrophe as a prefix and again as a suffix, then join the lines with commas. Three lines become 'alpha', 'bravo', 'charlie', which drops straight into a query. Two things to watch: nothing checks whether a prefix is already there, so running it twice gives you two, and blank lines are removed, so a list with deliberate gaps in it comes back closed up.

Questions

They are removed. A prefix with nothing after it is never what anyone wants.

MDN, working with strings
Advertisement
300 × 250
Was this tool any good?
Internal signal only · I use it to find the tools worth rebuilding