Converting between separators
A list is just items with something between them, and the something changes from place to place. A column copied from a spreadsheet has a line break between items. A list in an email has commas. Exported data may use tabs or semicolons. A search form or a database query often wants commas. This tool splits on whatever your list uses and joins on whatever you need.
With Detect automatically, a text with more than one line is split on line breaks. A single line is split on the most common of tab, semicolon, comma and pipe, and a line of words with only spaces is split on the spaces. If your list uses several kinds at once, choose Line break, comma, semicolon or tab. Space splits on any run of whitespace, line breaks included.
Quotes, escaping and ready made styles
Quotes make a list safe to paste into code. The ready made styles set up the details:
- SQL IN list wraps each item in single quotes, doubles any quote inside it (O'Brien becomes
'O''Brien'), and puts brackets around the whole list:('a', 'b', 'c'). - JSON array uses double quotes, escapes a quote or backslash inside an item with a backslash, and adds square brackets:
["a", "b", "c"]. - CSV row puts double quotes around each item, doubles any quote inside, and joins with commas, with no spaces.
- HTML list wraps each item in
<li>and the whole list in<ul>, and writes&,<and>inside an item as&,<and>so that the page shows the text as typed. The switch for this is under More options. Bullet list puts-before each item.
The tool works on text and does not know what an item means, so numbers are quoted too. Set Put quotes around each item to None when you want a list of numbers. Control characters such as a tab inside an item are not escaped, so check the result before using it as strict JSON.
Cleaning a list
Trim spaces removes spaces at the start and end of each item, and Remove empty items drops blank ones, so a stray comma or an empty line does not leave a gap. Remove duplicates keeps the first copy of each item. Turn on Ignore case to treat Apple and apple as the same item. The result shows how many empty items and duplicates were removed.
A to Z and Z to A follow your browser's language rules, so accented letters sort with their base letter. Numbers in order treats a run of digits as a number, so item2 comes before item10. The other orders are shortest first, longest first and reverse.
Quoted items and commas at line ends
When Read quoted items is on, an item that starts with a quote and has a closing quote followed by a separator is one item, with the quotes removed. That is how "Smith, Anna", "Lee, Bo" becomes two items, not four. An apostrophe in the middle of a word, such as in it's, is never read as a quote.
Remove commas at line ends handles the reverse case. If every line of a list ends with a comma or a semicolon, as in a list written for a code array, those are taken off before the items are joined again.