- Reference
- Script reference
- Strings and buffers
CSVtoInt
Extract a single parameter from a CSV formatted string.
Description#
CSVtoInt( const data[], item, decimals )Extract single numeric parameter from a CSV formatted string.
Parameters#
data | CSV formatted string |
item | Which item to extract. The first item is 1. |
decimals | Number of decimals to extract |
Assuming the input data is properly formatted as a CSV string (comma separated), this command finds the item by count and evaluates the item as a number. If decimals is larger than 0, that number of decimals will be added, and the resulting integer multiplied by 10 for each decimal.
Return value#
The integer value of the item.
Example usage#
new val;
new csvdata{} = "123, 1234.56, \"some string\", \"more data\"";
val = CSVtoInt( csvdata, 2, 3 );
// val will be 1234560Last updated Sep 2, 2019