TTKTheTextKit

Prefix / Suffix Adder

Paste a list, one item per line, and add text to the start and end of every line: quotes, tags, a bullet or a domain. Add a separator such as a comma after every item but the last, put the whole list on one line, and wrap it in brackets. Presets build a SQL IN list, a JSON array, a quoted list and an HTML list in one click, and quotes inside your lines can be escaped so the result stays valid.

Presets

Related Tools

[3 suggestions]

Guides for the Prefix / Suffix Adder

About the Prefix / Suffix Adder

The tool splits your text into lines and builds each item as prefix + line + suffix. A separator, such as a comma, goes after every item except the last, so a list never ends in a stray comma, and a space after the separator is kept when everything is on one line and dropped at the end of a line. With one item per line, the text you give for before the first item and after the last, such as ( and ) or [ and ], stands on its own lines. With all items on one line, they wrap the whole list. Blank lines are left alone or removed, and a line of spaces counts as blank. Trimming takes spaces and tabs off both ends of each line first. The escape option matters when your lines contain quotes. For a SQL list the tool doubles each single quote, so O'Brien becomes O''Brien inside 'O''Brien', which is how SQL writes a quote inside a quoted string. For JSON and JavaScript it escapes quotes, backslashes and control characters the way JSON does, so the list can be parsed back. A line break style of Windows or Unix is kept, and so is a final line break. For queries inside an application, use query parameters instead of building text. Everything runs in your browser and your text is never uploaded.

How do I add quotes and commas to a list?▾

Choose the Quoted, comma at line end preset, or type a quote mark as the prefix and the suffix and a comma as the separator. Every line gets the quotes and every line except the last gets the comma, so the list does not end in a stray comma.

How do I make a SQL IN list from a column of values?▾

Choose the SQL IN list preset. It trims each line, removes blank lines, wraps each value in single quotes, doubles any single quote inside a value, joins them with a comma and a space, and puts brackets around the list.

What does escaping quotes do?▾

It stops a quote inside a line from ending the quoted value early. For SQL, a single quote is doubled. For JSON and JavaScript, quotes, backslashes and control characters get a backslash. Without it, a value such as O'Brien breaks a SQL list.

Are blank lines changed?▾

Blank lines and lines of spaces get no prefix or suffix. You can keep them as they are or tick Remove blank lines. A list on one line never contains them.

Is it safe to paste the SQL into my database?▾

For a one-off query, an escaped list works. In an application, use query parameters instead, because they handle every case for you. Some databases, such as MySQL, also treat a backslash in a string as an escape, which this option does not cover.