FORMCSV()

FORMCSV()

Top  Previous  Next

 

The FORMCSV() function transforms a string to a CSV standard compliant item.

 

 

Format

 

FORMCSV(string)

 

where

 

stringis the string to be transformed

 

 

The FORMCSV() function converts the supplied string to comma separated variable format, treating each field as a separate item.

 

Three modes of conversion are supported:

1.Output conforms to the CSV format specification (RFC 4180). Items containing double quotes or the delimiter character are enclosed in double quotes with embedded double quotes replace by two adjacent double quotes.

2.Encloses all non-null values in double quotes except for numeric items that do not contain a comma. Embedded double quotes are replaced by two adjacent double quotes.

3.Encloses all values in double quotes. Embedded double quotes are replaced by two adjacent double quotes.

 

Mode 1 is used by default. This can be changed by use of the CSV.MODE statement. Any change persists through subroutine calls but the mode is reset to 1 in a new command processor level from use of EXECUTE, restoring the previous mode on return from the executed command.

 

 

See also:

CSV.MODE, CSVDQ(), DPARSE.CSV, READCSV, WRITECSV