Are there any CSV parsers floating around on this forum?
travis
Junior Member
I wrote one a long time ago, but it kind of sucked.
You can't search the forum for "CSV". Searching for "parser", I didn't see anything.
You can't search the forum for "CSV". Searching for "parser", I didn't see anything.
Comments
-
If you're just wanting to read the data into a two (well, technically 3) dimensional array what about iterating over each line with explode(..).
-
You could use DuetParseCmdParam from SNAPI.axi to separate a CSV string into individual parameters. Something along the lines of:
define_function integer ParseCSV(char cCSVString[], char cParameters[][]) { stack_var integer nNumParameters // number of parameters found in cCSVString nNumParameters = 0 while (length_array(cCSVString)) { nNumParameters++ cParameters[nParameters] = DuetParseCmdParam(cCSVString) } set_length_array(cParameters, nNumParameters) return nNumParameters }The total number of variables in the CSV line is returned from the function, and the individual variables are returned in whatever variable was passed as cParameters.
Andy -
https://github.com/laduke/netlinx-csv
I found some java article about CSV and converted it to netlinx. It's a mess. Seems to mostly work. I've lost interest. -
It seems to me that is would be as much work adapting a general parser to specific data as writing a new one each time. There is too much variance in how a CSV can store data. Just read it in, line-by-line, and break it into tokens at the commas. What you do with the tokens is the trick, and that is different for every data set.
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums