DS Toolkit
Convert List

Help

Help

Overview

Using this tool, you can convert various types of lists. For example, you can convert vertical list like this

apple
pear
orange
banana
grapefruit

to horizontal one like this

apple pear orange banana grapefruit

Main interface

There are two boxes separated by a button with an arrow on it. The first box is for lists you want to convert (input lists), and it's editable. The second one is for conversion results of these lists (output lists), and it's read-only. A conversion starts by pressing the green button.

Settings

There is also a settings panel. You can change a result of a conversion using the following elements on the panel.

Input list delimiter

A list is basically a set of items separated by one or more characters like commas, dots, colons, etc., including special characters such as \n (line feed), \r (carriage return), and \t (horizontal tab). There is a need to set the right delimiter in order to specify an input list.

For example, this list

apple , pear , orange , banana , grapefruit

has comma (,) as a delimiter.

Let's look at another example

apple , pear ; orange , banana ; grapefruit

In this case, delimiter could be comma or semicolon. It's up to you to decide which character to use.

If the element is disabled (when the checkbox on the left is unchecked), then the delimiter will be recognized automatically. In most cases, there is no need to set some delimiters manually.

Output list delimiter

This delimiter is used for the making of output lists. Here's an example with comma as a delimiter

Input listapple pear orange banana grapefruit
Output list delimiter,
Output listapple , pear , orange , banana , grapefruit

And another one with semicolon

Input listapple pear orange banana grapefruit
Output list delimiter;
Output listapple ; pear ; orange ; banana ; grapefruit

Remove leading/trailing whitespace characters for each list item

If this element is checked, leading and trailing whitespace characters will be removed for each list item. Space, horizontal tab, line feed, carriage return, form feed, and vertical tab are whitespace characters. For example

apple   pear   orange   banana   grapefruit  

Here each list item has a tail space. Check Remove leading/trailing whitespace characters for each list item in order to remove these tails

applepearorangebananagrapefruit

Remove empty list items

At times, after manipulations with some settings, you might get empty items in output lists

apple, , pear, orange, banana, grapefruit

As you can see, the second item of the list is empty, but if you check Remove empty list items, this item will be removed

apple, pear, orange, banana, grapefruit

Remove duplicates

If this element is checked, all duplicate items will be removed

Input listapple, pear, orange, banana, grapefruit, apple
Output list delimiter
Remove duplicates
Output listapple, pear, orange, banana, grapefruit

Sort

Check this element if you want to sort your list

Input listapple, pear, orange, banana, grapefruit
Output list delimiter
Sort
Output listapple, banana, grapefruit, orange, pear

Shuffle

Check this element if you want to shuffle all items of your list randomly.

Remove wraps of input list

Let's take a look at following list

[(apple), (pear), (orange), (banana), (grapefruit)]

Here is list wrap ([ and ]) and item wrap (( and )). In order to remove these wraps, just fill in fields of Remove wraps of input list

Input list[(apple), (pear), (orange), (banana), (grapefruit)]
Output list delimiter
Remove wraps of input list → List wrap → Head[
Remove wraps of input list → List wrap → Tail]
Remove wraps of input list → Item wrap → Head(
Remove wraps of input list → Item wrap → Tail)
Output listapple, pear, orange, banana, grapefruit

Add wraps to output list

If you want to do the same things from the previous paragraph but vice versa, fill in fields of Add wraps to output list

Input listapple, pear, orange, banana, grapefruit
Output list delimiter
Add wraps to output list → List wrap → Head[
Add wraps to output list → List wrap → Tail]
Add wraps to output list → Item wrap → Head(
Add wraps to output list → Item wrap → Tail)
Output list[(apple), (pear), (orange), (banana), (grapefruit)]

Replace text

In order to replace one text with another, fill in fields of Replace text. All occurrences of search string will be replaced by replacement string (or they will be simply removed if replacement string is empty).

Examples

Convert comma-separated list to JavaScript array

Input listapple, pear, orange, banana, grapefruit
Output list delimiter
Add wraps to output list → List wrap → Headvar fruits = [
Add wraps to output list → List wrap → Tail];
Add wraps to output list → Item wrap → Head"
Add wraps to output list → Item wrap → Tail"
Output listvar fruits = ["apple", "pear", "orange", "banana", "grapefruit"];

Convert PHP array to Python dictionary

Input list$fruits = array(1 => "apple", 2 => "pear", 3 => "orange", 4 => "banana", 5 => "grapefruit");
Input list delimiter=>
Output list delimiter
Remove leading/trailing whitespace characters for each list item
Remove wraps of input list → List wrap → Head$fruits = array(
Remove wraps of input list → List wrap → Tail);
Add wraps to output list → List wrap → Headfruits = {
Add wraps to output list → List wrap → Tail}
Output listfruits = {1: "apple", 2: "pear", 3: "orange", 4: "banana", 5: "grapefruit"}

Back to main page →

Back to top →