CSVDQ()

CSVDQ()

Top  Previous  Next

 

The CSVDQ() function de-quotes a CSV (comma separated variable) string.

 

 

Format

 

CSVDQ(string {, delimiter})

 

where

 

stringis the string to be processed.

 

delimiteris the delimiter character separating the elements of the string. This defaults to a comma if omitted.

 

 

The CSVDQ() function de-quotes a CSV string, removing outer double quotes, handling embedded quotes and returning the result as a dynamic array where each element of the original string is represented by a separate field. This is in accordance with the CSV format specification (RFC 4180).

 

 

Examples

 

S = 'ABC,"DEF","GHI,JKL","MN""O"'

DISPLAY CSVDQ(S)

 

The above program fragment would display

ABCFMDEFFMGHI,JKLFMMN"O

 

ABC was unquoted and remains unchanged.

DEF was quoted. The quotes have been removed.

GHI,JKL contains a comma that has been preserved after removal of the quotes.

MN"O contains an embedded quote that has been preserved.

 

 

READSEQ DATA FROM SEQ.F THEN REC = CSVDQ(DATA)

 

The above program fragment reads a line of CSV format data into variable DATA and then uses CSVDQ() to parse the elements into a field mark delimited dynamic array.

 

 

See also:

DPARSE.CSV, FORMCSV(), READCSV, WRITECSV