᠎᠎᠎          
51K

List truncator

World's simplest list tool

This is a super simple browser-based application that truncates a list and returns the beginning or end part of a list with the requested number of items. You can use any character as a separator for the list items and specify it in the item delimiter option using one or more characters or a regular expression. Additionally, you can set the length of the truncated list and choose the side to remove items from. Created by list geeks from team Browserling.
A new project! we made something new
We just created Online GIF Tools that offers tools for working with GIFs. Check it out!
Delimiter for List Items
Separate items of the list by a delimiting character.
Separate items of the list by a regular expression.
Delimiter or regular expression.
Truncation Length and Side
Leave this many list items.
Delete list items from the end.
Delete list items from the beginning.
Item Joiner
Use this joining character in the output.
List truncator tool What is a list truncator?
With this online program, you can cut lists to precise length. It works with all kinds of lists – textual, numeric, and character lists. It's very flexible and can adapt to multiple list formats, which includes lists with items separated by a single character, multiple characters, constant length patterns, and even complicated patterns that can only be matched via a regular expression. The "Delimiting Character" mode is the simplest list delimiter mode and matches list items separated by one character (or one string). The "Delimiting Regex" allows you to match several separators at once by using a regular expression. As soon as the program parses the list and splits it into individual items, it truncates this list to the specified length. You can set the truncation length in the second block of options and also select the truncation side. If you select the "Remove the Start" option, then list items will be dropped from the beginning of the list. If you select the "Remove the End" option, then list items will be dropped from the tail part of the list. After the list is truncated, its items are recombined together again via a new delimiter character (or string) that you can set in the join-character option. Listabulous!
List truncator examples Click to use
Truncate a List of Stars
This example truncates a list of names of stars. The names are listed in a column, so we set the input separator to a newline using the character "\n". We remove items from the end of the list and leave only the first 4 items in the truncated list, which we then separate by tabs.
Polaris Sirius Toliman Betelgeuse Rigel Vega Antares Canopus
Polaris Sirius Toliman Betelgeuse
Required options
These options will be used automatically if you select this example.
Separate items of the list by a delimiting character.
Delimiter or regular expression.
Leave this many list items.
Delete list items from the end.
Use this joining character in the output.
Shorten a Water Transport List
In this example, we use our truncation program to shorten a list of water transportation vehicles. This list of vehicles is presented as a single line string that uses a comma and the word "and" between its items. To match all separators and extract list items, we use the regex split mode and enter the expression "/\s*(?:,|and)\s*/g". Note that the regex group "(,|and)" uses the "?:" modifier that makes the group non-matching. If we didn't use this modifier, then commas and the word "and" would be included in the list items. We truncate the list to 8 items, removing them from the start. We display the output item as a column with one vehicle per line.
cruise ships, racing boats, off-road riding boats, windsurfer boats, riverboats, jet skis, battleships, raft boats, canoes and ferries, yachts, submarines and tugboats
jet skis battleships raft boats canoes ferries yachts submarines tugboats
Required options
These options will be used automatically if you select this example.
Separate items of the list by a regular expression.
Delimiter or regular expression.
Leave this many list items.
Delete list items from the beginning.
Use this joining character in the output.
Truncate a Morse Code Message
In this example, we truncate a message in Morse code. The input list consists of elements in the form of dots and dashes and separators in the form of slashes. The elements of this list are single Morse code characters. To find them and form a message, we use the "/" delimiter character and enter it in the options. We take just the first 7 elements/characters of the list and separate them with the original slash delimiter in the output list.
-.--/---/..-/......./.-/.-././......./-/...././......./-..././.../-
-.--/---/..-/......./.-/.-./.
Required options
These options will be used automatically if you select this example.
Separate items of the list by a delimiting character.
Delimiter or regular expression.
Leave this many list items.
Delete list items from the end.
Use this joining character in the output.
Pro tips Master online list tools
You can pass input to this tool via ?input query argument and it will automatically compute output. Here's how to type it in your browser's address bar. Click to try!
https://onlinelisttools.com/truncate-list?input=Polaris%0ASirius%0AToliman%0ABetelgeuse%0ARigel%0AVega%0AAntares%0ACanopus&string-separator=true&input-separator=%5Cn&remove-end=true&list-length=4&join-character=%5Ct
All list tools
Didn't find the tool you were looking for? Let us know what tool we are missing and we'll build it!
Quickly print all distinct items of a list.
Quickly print all repeating items of a list.
Quickly count the number of items in a list.
Quickly find certain items in a list.
Quickly print all list items in reverse order.
Quickly sort list items alphabetically or numerically.
Quickly shuffle list items and make it random.
Quickly randomly pick one or more items from a list.
Quickly set a new delimiter for items in a list.
Quickly remove items from the beginning or end of a list.
Quickly join all items of a list together.
Quickly extract a part of a list.
Quickly remove all empty items from a list.
Quickly remove whitespace characters around list items.
Quickly create multiple copies of a list.
Quickly rotate list items to the left or right (or up and down).
Coming soon These list tools are on the way
Split a List
Split list items into chunks.
Generate the Powerlist
Create the powerlist of the given list.
Find the Car of a List
Extract the first item from a list.
Find the Cdr of a List
Extract all items except the first of a list.
Apply a Function on a List
Run a JavaScript function on every list item.
Find Non-repeating List Items
Quickly find and print items that don't repeat in a list.
Find Repeating List Items
Quickly find and print items that repeat in a list.
Delete Repeating List Items
Quickly find and remove items that repeat in a list.
Delete Unique List Items
Quickly find and remove items that are unique in a list.
Delete List Separator
Remove the symbol that separates list items.
Extract a Sublist from a List
Given start and stop indexes, extract a sublist from a list.
Shift List Items
Shift list items to the left or right (or up and down).
Mirror a List
Quickly create a mirror copy of a list.
Invert a List
Invert the order of items in a list (last becomes first, etc).
Reduce a List
Run the reduce function on a list.
Convert a List to an Image
Create an image from a list.
Convert a List to Columns
Create multiple columns from a single list.
Convert a List to Rows
Create multiple rows from a single list.
Convert a List to Excel
Create an Excel file from a list.
Convert a List to PDF
Create a PDF file from a list.
Convert a Text List to a LaTeX List
Create a LaTeX list from a regular text list.
Convert a Text List to a HTML List
Create a HTML list from a regular text list.
Convert a Text List to a Markdown List
Create a Markdown list from a regular text list.
Zip Two Lists
Join two lists together item by item.
Merge Two Lists
Append a second list at the end of the first list.
Pop List Items
Remove list items at certain index positions.
Push List Items
Add new items at the end of a list.
Replace List Items
Replace certain items in a list with new items.
Splice a List
Modify a list in-place by adding, replacing, or removing items.
Create the Empty List
Generate a list with no items.
Create a Random List
Generate a list with random items.
Color List Items
Quickly add colors to list items.
Enumerate List Items
Quickly add a counter to each list item.
Visualize a List
Quickly create a graphical representation of a list.
Let Zalgo Destroy a List
Let Zalgo loose on a list and create list-chaos.
Print List Statistics
Analyze a list and print its item statistics.