Delimiter

Updated: 06/07/2019 by Computer Hope
Pipe and double pipe

A delimiter is one or more characters that separate text strings. Common delimiters are commas (,), semicolon (;), quotes ( ", ' ), braces ({}), pipes (|), or slashes ( / \ ). When a program stores sequential or tabular data, it delimits each item of data with a predefined character.

Delimited text example

For example, in the data "john|doe," a vertical bar (the pipe character, |) delimits the two data items john and doe. When a script or program reads the data, it treats a vertical bar as the end of one data item, and the beginning of another. In the following example of delimited text, each line contains contact information for a person. A program could be created to gather each of these values and display them in an easy to read or print format or parsed to find specific values. For example, you could quickly parse this file and find the name of all females.

john|doe|male|123 street|555-1234
jane|smith|female|321 street|555-4321
bill|gates|male|987 street|555-9876
Tip

If you are writing a script or program that has delimited text, we recommend using an uncommon delimiter. Using a comma as a delimiter has a good chance of getting split in the wrong place. If you need to use a comma as a delimiter, use two or three commas instead of only one unless the text is a name or something that does not have a comma (like an address).

Example of using a delimiter in the Perl programming language

use strict;
my $example = "John|Doe";
my ($first, $last) = split(/\|/, $example);
print "Hello $first,\nI see your last name is $last it is nice to meet you.\n"

In the example above, Perl code, the $example variable contains text with a pipe delimiter that is split into two new variables called $first and $last. Once the data is split, it prints the output results below.

Hello John,
I see your last name is Doe it is nice to meet you.

Windows command line for command delimiter

In the Windows command line for command, delimiters are specified using the delims= option. For example, delims=, indicates the delimiter is a comma.

CSV, Divider, Programming terms, Separator, Spreadsheet terms