08-12-2009 07:47 AM
08-12-2009 08:28 AM
Good rules!
Scan String for Tokens is a very powerful tool for parsing complicated strings. Along with the power comes a significant level of complexity and a steep learning curve. I have found it to be very helpful to create a number of small test VIs while learning how to use it. The Delimiters array and the Operators array work in subtly different ways.
For your string the Match Pattern and String to Spreadsheet Array functions are probably adequate as has been suggested by others.
I have used the Scan String for Tokens for parsing assembly language as part of a cross assembler.
Lynn
08-12-2009 08:35 AM - edited 08-12-2009 08:35 AM
I use the scan for tokens all over the place.
Performance is pretty good even with large strings because it doesn't split up the original string, allowing you to search in the original data and only allocate new memory for the found strings. Reading in a big file and need to find a few small parts? Scan for tokens is your man
If your search is repetitive you can also cache the delimiters although there was a bug in this a while back (I filed it but I can't find it any more. I think the bug was in 6.1 so it's most likely long gone by now).
Shane.
08-21-2009 02:05 AM
Escrito por Alain S:Just in case you expect more than 1 string between tokens 🙂
![]()
![]()
No one asked for it, yet, but who knows what tomorrow brings
Just that I need, Thanks!
06-08-2021 07:35 AM
Two instances per loop!? kaboom, mind blown! I too have struggled with this primitive for YEARS thinking it must have an obvious use case that was eluding me. You have inspired the attached vi (back-saved to 8.0) that pulls out desired XML attributes out of a string.