06-01-2011 12:08 PM
@Phillip Brooks wrote:
I recently needed to parse a CSV that contained quotes and line breaks within a field. Here is my solution (LV 8.0)...
Phillip's solution looks very nice but ,as a Caution; you may need to toggle the Quote boolean on 0x22 ", 0x93 “ or 0x94 ” if the file is generated by an editor that knows to open and close quotes. (Got bit myself on that one yesterday)
06-01-2011 12:13 PM
@Jeff Bohrer wrote:
@Phillip Brooks wrote:
I recently needed to parse a CSV that contained quotes and line breaks within a field. Here is my solution (LV 8.0)...
Phillip's solution looks very nice but ,as a Caution; you may need to toggle the Quote boolean on 0x22 ", 0x93 “ or 0x94 ” if the file is generated by an editor that knows to open and close quotes. (Got bit myself on that one yesterday)
Sounds like a good one for here.
http://forums.ni.com/t5/BreakPoint/LabVIEW-Minutiae-that-may-bite-you-someday/td-p/1122234/page/3
06-08-2011 01:23 PM
This version replaces opening and closing quotes (0x93 and 0x94) with straight quotes before parsing. I also added a string input option for my internal use of this function.
05-12-2016 02:18 PM
Thanks so much Phil!!!!
-I've been working on this on my own for two days now. I got my vi to leave the commas inside the quotations, but it was taking over 30 seconds to complete!
Rather than try to further troubleshoot and waste time, I decided to google the issue. Luckily I came across your post!
This really makes my day, Thanks!!!!
07-19-2017 03:45 PM
Does anyone have a VI that converts an array to strings to a CSV format as well? Of course with the same requirements as above.
07-21-2017 10:54 AM
I'm not quite sure what you're looking for here. You want an array to be converted to a string, and then written to a CSV? Or an array of strings to be written to CSV?
Nick B.
Applications Engineer
National Instruments
09-20-2019 03:13 PM
I'm sorry. That was not worded correctly.
PhillipBrooks' VI takes a CSV String as input and outputs a 2D Array of Strings. I was also looking for a VI that takes a 2D Array of Strings as input and outputs a CSV String.
Turns out this has been implemented here. This says it follows RFC-4180 which the Wikipedia article mentioned in the first post of this thread refers to.
09-20-2019 03:18 PM
You do realize this tread has not had a reply in almost two year?
There is no difference between string array and CSV. They are both text file. CSV only tell the software you are using how to interpret the data. You should be able to save an array of stings to a file with a CSV extension using LabVIEW very easily. That is standard stuff int he file palette.
09-21-2019 09:35 AM
Just to put closure on this thread
Prior to 2015, the function "Join Strings.vi" was a hidden gem in vi.lib found underneath the advanced strings folder.
@ 2015 the function of Array to Spreadsheet String changed. And really does the same thing right.
2019 has native string pallet items that implement string array to delimited string and delimited string to string array.
How much easier do you want it to be?
09-23-2019 12:11 PM
@JÞB I tested both Array to Spreadsheet String (in LV 2018) and String array to delimited string and they both do NOT handle the delimiter in a cell which I think is the point of this thread. This is demonstrated by the attached VIs.