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 and encounters a vertical bar, it knows that one data item has ended, and another begins. 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
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
Related pages
- How to create a computer program.