A delimiter is a text character (or a sequence of characters) that separates elements in a text string or data stream. Some delimiters separate an object into multiple pieces of data, while other delimiters establish boundaries around data to provide structure. Delimiters can provide a reliable and predictable way to split text strings for computer programming, text parsing, and data analysis.
Delimiters are utilized in many different contexts. Programming languages use several delimiter characters to structure and format code, like parentheses and brackets to enclose code blocks and semicolons to mark the end of a statement. CSV files use commas, tabs, or pipes to separate columns in a database record, and new line characters to separate rows from each other. Command line interfaces let you use delimiters to separate commands from modifying parameters. URL addresses include several kinds of delimiter, including slashes that indicate documents nested within folders, colons that separate a domain name from a port number, and question marks that separate a document's location from additional parameters provided to the web server.
If you can choose a delimiter for text parsing or data analysis, it's best to choose one that does not appear in the text itself. If that cannot be avoided, you need to add an escape character to every instance of that character in the text that you don't want to use as a delimiter. The following example uses a comma (,) as a delimiter between data fields in a CSV file; any comma that does not separate one data field from another should be preceded by a backslash, as seen in the record's address field.
John Doe,30,"4500 2nd Ave\, Unit 12"