Discussion:
What is the best way to read a CSV string
(too old to reply)
Kaspar
2008-08-12 16:10:08 UTC
Permalink
Hello,
 
   What is the best way to read a CSV (Comma Seperated Value) string with the following constraints
 

- Do not know how long the string is, but for this discussion we could assume no longer than 500 chars

- Do not know how the max number of commas that will be in the string, but there will be at least 1 comma (for 2 values in the string) 

If I was using PERL (the split function) or if the formula nodes could handle strings, then this would be solved. I have tried to use the "scan from string" vi, and keep getting Error 85. This vi also assue that the user knows how many commas are in the CSV string before you try to extract the values from the string. Any ideas on how I can do this?
Regards,
Kaspar
 
 
smercurio_fc
2008-08-12 16:10:09 UTC
Permalink
How about just using Spreadsheet String to Array? That's what that function is for.
unclebump
2008-08-12 16:10:10 UTC
Permalink
or maybe scan string for tokens. Do you want an array of strings as the output??Message Edited by unclebump on 08-12-2008 11:07 AM


scan string for tokens.vi:
http://forums.ni.com/attachments/ni/170/348687/1/scan string for tokens.vi
Kaspar
2008-08-12 16:40:19 UTC
Permalink
Hello,
 
   The vi you posted is in Labview 8.2, could you repost it as a 8.2 vi? I am looking to get the values back as strings.
 
Regards,
 
Kaspar
smercurio_fc
2008-08-12 16:40:19 UTC
Permalink
<img src="Loading Image..."> To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's <a href="http://zone.ni.com/devzone/cda/tut/p/id/5054" target="_blank">Learning Center</a> which provides links to other materials and other tutorials. You can also take the <a href="http://www.ni.com/academic/lv_training/how_learn_lv.htm" target="_blank">online courses</a> for free. Message Edited by smercurio_fc on 08-12-2008 11:21 AM


Example_VI_BD6.png:
http://forums.ni.com/attachments/ni/170/348703/1/Example_VI_BD6.png
unclebump
2008-08-13 10:40:19 UTC
Permalink
Here is the 8.2 version.


scan string for tokens.vi:
http://forums.ni.com/ni/attachments/ni/170/348911/1/scan string for tokens.vi
Kaspar
2008-08-13 11:40:24 UTC
Permalink
Hello,&nbsp;&nbsp;&nbsp; Thanks for the 8.2 version!&nbsp;Regards,&nbsp;Kaspar
Continue reading on narkive:
Loading...