LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find tabs?

Hello 🙂

We have a string with 5 words that are differenteated by tabs. Can we try to match the tabs in some way to pick out the words? The thing is that we want to show the first word on the frontpanel, the following two words we do not want the user to see but they are needed later anyway. And the following last 2 words we want the user to see in the front panel. Any ideá of which VI we can use? Is there any VI-s that search for tabs? Thank you 🙂 Best regards.
0 Kudos
Message 1 of 6
(3,558 Views)
The two functions you're looking for can be found in the string palette. The first is Search\split string which can be found in the additional functions subpalette. The second is the tab constant. Keep in mind that if you parse the string, you need to either use a shift register, and keep cutting the string until you reach the end, or you have to wire a higher index value into the offset input of the search VI.

___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(3,552 Views)
Thank you for your answer!
There was one thing we did not understand what you meant... what did you mean by : if you parse the string ? We will have a check for the VI-s that you suggested 🙂
0 Kudos
Message 3 of 6
(3,548 Views)
Hello again 🙂

How do you mean with the while-loop to cut the strings? Should one count the numbers of tab-constants in the while-loop in some way? Best regards!
0 Kudos
Message 4 of 6
(3,546 Views)
Parse and cut in this case are the same thing: Go over the string using (usually) a while loop and search for a tab. The condition to stop should be when you find no more tabs (offset = -1). If you want, you can also use a for loop. The search VI splits the strings, so you keep the text before the split position and you wire the text that's after the split position into the shift register to be your new string (after using string subset to remove the tab character).

___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(3,540 Views)
You can also use a higher-level function to simplfy the code. User the Spreadsheet String to Array function and wire in the tab as the delimiter and a single dimension string constant as the array type. Specify a format of %s.
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
Message 6 of 6
(3,516 Views)