08-11-2009 10:02 PM
OK I have been working with LabVIEW for many years and I have never understood the Scan strings for Tolkens.
Attached is what I expect, and what I am getting. Please set me strait once and for all.
Dan
Solved! Go to Solution.
08-11-2009 10:06 PM
08-11-2009 10:08 PM - edited 08-11-2009 10:11 PM
Your input string control is empty. Try saving your VI again and posting it after putting some data in the input string and saving it as default.
Never mind, you reposted the VI.
08-11-2009 10:29 PM - edited 08-11-2009 10:30 PM
I've never used scan token string before. Looking at the Context help and examples for it, it looks like it is meant to break up a string by the tokens, and is most useful if it is in a loop. In your case, you are trying to find a string "wrapped" in your token.
I would use Search/Split string or Match Pattern to find the quotes and strip them out from there.
08-11-2009 11:29 PM
I couldn't open the VI (still waiting for upgrade), but I did use the Scan String for Tokens in an example recently. I have found it to be quite useful when I have a complex string to parse, with unknown or varying number of parameters. I find that strings with regular patterns are more efficiently dealt with using string to spreadsheet array or scan string to number.
Reading Ravens Fan's post, I gather you are looking for values inside quotes, I have enclosed an example which pulls numbers out of a quoted, comma separated list. The quotes are delimiters and tokens are the values you are looking for. Hope this helps.
08-11-2009 11:47 PM
08-12-2009 05:33 AM
08-12-2009 06:33 AM
First of all, you're looking for the output from the wrong place. "String out" is an unmodified copy of the input string.
"Token out" is the response you're looking for.
The first iteration will find your starting " as adelimiter and deliver the part of the string up to but not including the " character. The second time you call the function (wiring through the returned index from the first run) it will give you the text between the first and second " which is exactly what you're looking for.
Shane.
PS My first Snippet! 😄
08-12-2009 07:07 AM
Just in case you expect more than 1 string between tokens 🙂
No one asked for it, yet, but who knows what tomorrow brings
08-12-2009 07:40 AM