ezeio2:scriptref:csvtostr

Extract a single parameter from a CSV formatted string.

Description

CSVtoStr( const data[], destination[], maxlen, item )

Extract single parameter from a CSV formatted string.

Parameters

data CSV formatted string
destination Buffer for extracted parameter
maxlen Max size of the destination buffer
item Which item to extract. The first item is 1.

Assuming the input data is properly formatted as a CSV string (comma separated), this command finds the item by count and copies the string data into destination.

Return value

Number of characters copied into destination. If the item is not found, return 0.

Example usage

   new param{128};
   new csvdata{} = "123, 1234, \"some string\", \"more data\"";
 
   CSVtoStr( csvdata, param, 128, 3 ); 
 
   // param will now hold the text "some string" without quotes.
  • ezeio2/scriptref/csvtostr.txt
  • Last modified: 2019-09-02 21:37
  • by andreh