᠎᠎᠎          
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.
We put a browser in your browser! Browserling
Check out our project Browserling – get a browser in your browser.
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 display list items in multiple colors.
Quickly generate a list of arbitrary length with arbitrary items.
Quickly generate a random length list with random items.
Quickly find certain items in a list.
Quickly replace certain items in a list with new items.
Quickly remove items from a list that match a pattern.
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 create a downloadable image from a list.
Quickly set a new delimiter for items in a list.
Quickly remove the symbol that separates list items.
Quickly change list item delimiters to the same symbol.
Quickly remove items from the beginning or end of a list.
Quickly join all items of a list together.
Quickly create groups of multiple list items.
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).
Quickly enumerate list items and add a counter to them.
Quickly add bullet markers to all items in a list.
Quickly remove all bullet markers from list items.
Quickly wrap all list items in quotes.
Quickly remove all quotation marks from around list items.
Quickly add text on the left and right sides of all list items.
Quickly remove text from the left and right sides of all list items.
Quickly prepend a prefix before each list item.
Quickly delete any prefix from the beginning of all list items.
Quickly append a suffix after each list item.
Quickly delete any suffix from the end of all list items.
Quickly add or remove list items to make it a certain length.
Quickly create multiple columns from a single list.
Quickly create a palindromic list from the given list.
Quickly add new items at the beginning or end of a list.
Quickly left-pad a list with one or more items.
Quickly right-pad a list with one or more items.
Quickly remove items that repeat in a list.
Quickly apply a filter on all list items (extract certain items).
Quickly analyze a list and print its item statistics.
Coming soon These list tools are on the way
Edit a List
View and edit lists in a neat browser-based list editor.
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 Certain List Items
Quickly find and print items that interest you in a list.
Find Repeating List Items
Quickly find and print items that repeat in a list.
Delete Unique List Items
Quickly find and remove items that are unique in a list.
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).
Indent List Items
Add indentation to all list items.
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 Rows
Create multiple rows from a single list.
Convert a List to Excel
Create an Excel (XLS/XLSX) 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.
Compare Two Lists
Find the difference between two lists.
Compare Three Lists
Find the difference between three lists.
Remove One List from Another
Remove elements from a list that appear in the other list.
Find Common Items in Lists
Find items that are shared between two or more lists.
Find Distinct Items in Lists
Find items that are unique in two or more lists.
Zip Two Lists
Join two or more lists together item by item.
Unzip Two Lists
Split an interleaved list into two or more separate lists.
Merge Two Lists
Append a second list at the end of the first list.
Pair List Items
Create pairs from all list items.
Pop List Items
Remove list items at certain index positions.
Push List Items
Add new items at the end of a list.
Splice a List
Modify a list in-place by adding, replacing, or removing items.
Flatten a List
Remove all indentation levels from a list and make it flat.
Make List Items Title Case
Quickly change the letter case of all items to title case.
Make List Items Proper Case
Quickly change the letter case of all items to proper case.
Make List Items Random Case
Quickly randomly change the letter case of all items.
Make List Items Lowercase
Quickly change the letter case of all items to small letters.
Make List Items Uppercase
Quickly change the letter case of all items to capital letters.
Remove List Item Counter
Quickly remove any numeration from a list of items.
Create the Empty List
Generate a list with no items.
Visualize a List
Quickly create a graphical representation of a list.
Create a List Cloud
Create an image with a cloud of list items.
Create a Spiral List
Create an image with list items going in a spiral.
Create a ZigZag List
Make list items go in a zigzag.
Add Errors to a List
Add errors and corruption to a list.
Base64-encode a List
Convert any list to base64 encoding.
Base64-decode a List
Convert any list from base64 encoding back to a list.
URL-encode a List
Convert any list to URL encoding.
URL-decode a List
Convert any list from URL encoding back to a list.
Convert a List to JSON
Create a JSON array from a list.
Convert JSON to a List
Create a list from a JSON array.
Convert a List to XML
Create an XML document from a list.
Convert XML to a List
Create a list from an XML document.
Convert a List to YAML
Create a YAML file from a list.
Convert YAML to a List
Create a list from a YAML file.
Convert a Text List to a Binary List
Create a binary list from a text list.
Convert a Binary List to a Text List
Create a text list from a binary list.
Compress a List
Compress a list so it uses less space.
Let Zalgo Destroy a List
Let Zalgo loose on a list and create list-chaos.