3.5.7.25 MakeCSV

Description

This function converts a string which has a delimiter into CSV format.

Syntax

string MakeCSV(string str$ [, int quote, int output_delim, string input_delim$])

Parameters

str

The string to be converted.

quote

Specify whether to add quote. The default value 0 means do not add quote. 1 means single quote ( ' ) and 2 means double quote ( " ).

input_delim

Specify the delimiter in the CSV formatted string. Default value 0 means comma separator ( , ) and 1 means semicolon separator ( ; ).

output_delim

Specify the delimiter in the source string. Not needed if delimiter is white space: <space>, <tab>, <carriage return>, <line feed>.

Return

Returns a CSV formatted string.

Example

string str1$="This is test value";
string str2$=MakeCSV(str1$, 2, 1)$;
str2$=; //should return "This";"is";"test";"value"
string str1$="This|is|test|value";
string str2$=MakeCSV(str1$, 1, 0,"|")$; // Specify source delimiter
str2$=; //should return 'This','is','test','value'