LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scan tolken string

Solved!
Go to solution

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

Dan Shangraw, P.E.


   

0 Kudos
Message 1 of 15
(5,914 Views)

Would help if I posted a VI that illustrates my problem.

 

Late night and I am woozy from beating my head against the wall.

Dan Shangraw, P.E.


   

0 Kudos
Message 2 of 15
(5,910 Views)

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.

Message Edited by Ravens Fan on 08-11-2009 11:11 PM
0 Kudos
Message 3 of 15
(5,909 Views)

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.

Message Edited by Ravens Fan on 08-11-2009 11:30 PM
0 Kudos
Message 4 of 15
(5,902 Views)

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. 

0 Kudos
Message 5 of 15
(5,886 Views)
Oops, posted old version, here is the corrected vi with initialized SR in while loop.
0 Kudos
Message 6 of 15
(5,883 Views)

I'm getting something different...

 

scanstring.jpg

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 7 of 15
(5,857 Views)
Solution
Accepted by ASTDan

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.

 

 Scan from token snippet.png

 

Shane.

 

PS My first Snippet! 😄

Message 8 of 15
(5,851 Views)

Just in case you expect more than 1 string between tokens 🙂

 

SNAG-019.jpg  

 

SNAG-020.jpg 

 

 

No one asked for it, yet, but who knows what tomorrow brings Smiley Very Happy

Message 9 of 15
(5,842 Views)

Wow!  Thats how that works!  I was just inputing quotation marks.Smiley Happy

 

I am going to haning out with Tom Bombadil now.

Dan Shangraw, P.E.


   

0 Kudos
Message 10 of 15
(5,838 Views)