LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Seperate string in parts

Hello
I have the following problem:
I have a string with various values. It looks like that:" 205,0;1; 20,0;0; 65,0;22,0; 50;1;1;2500;Comment"
Some values have a defnite width " 205,0" for example.
Now I hav to seperate all these values and write each to a local variable, so that I can use the value for some calculations.
How can I do this easily?

Thanks for your help
0 Kudos
Message 1 of 6
(2,882 Views)
Just use the scan from string function (see attached solution example) with the correct format string...
Message 2 of 6
(2,882 Views)
It looks like you have semicolons between values (;) so another alternative is to use the "spreadsheet string to array" function with a semicolon as the delimiter. This will result in a 1D array of your values that you can then index apart.

In some ways this is a more general solution because scan from string can start behaving strangely when parsing stings containing values that will be interpreted as text (like the comment at the end of your example).

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 6
(2,882 Views)
Yes you may be right. But my programm only creates the strings in that way. so you have to change the sourcecode for other values.
0 Kudos
Message 4 of 6
(2,882 Views)
I think you misunderstood what I meant. You can leave your existing code the way it is. All I was talking about is how you could parse the string the existing code generates.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 6
(2,882 Views)
Yes sorry, it was my mistake. Thanks for your help.
0 Kudos
Message 6 of 6
(2,882 Views)