Comma Counter

What Is a Comma Separated List

A comma separated list is a series of values divided by commas. For example, red, green, blue is a list with three values.

What is a comma-delimited list?

A comma-delimited list and a comma separated list are the same type of text. A comma acts as the delimiter between one value and the next value.

The list can contain words, numbers, email addresses, product codes, or other short values. Some systems allow a space after each comma. Other systems require no spaces.

Sources:RFC 4180: Common Format and MIME Type for CSV FilesMicrosoft Support: Import or link to data in a text file

Examples of comma separated lists

A basic list has one fewer comma than values. This rule changes when the text contains an empty item or when a value contains a comma.

  • red, green, blue contains three color names.
  • 104,208,312 contains three numbers.
  • A12,B07,C31 contains three product codes.
  • red,,blue contains an empty item between two commas.

How to handle commas inside values

A simple comma separated list cannot distinguish a delimiter comma from a comma that belongs inside a value. CSV formats solve this problem by putting such values inside double quotation marks.

The comma counter counts comma characters only. It does not parse quotation marks or CSV fields. Use a CSV parser when each value must be identified correctly.

Sources:RFC 4180: Common Format and MIME Type for CSV FilesPython documentation: CSV file reading and writing

Sources

More answers