LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I compare and match one string to a list of multiple strings?

I want to compare one string to a list of multiple strings. If the string I want to compare matches any string within the predetermined list, I want the program to enter a loop or case structure and perform the action within the loop. I'm thinking that I need to have an array with all the strings and use a comparator to check if the string I've entered/typed is located within the list of preset strings. I don't know if that makes any sense. I also don't want to read from a text file. Thank you in advance

 

.Image.JPG

 

0 Kudos
Message 1 of 4
(8,383 Views)

Make an array of predermined string (similar to what you stated) and then check for offset past match greater than 0. If string si not found offset past match will be -1.Ofcourse there are other ways to achieve this. You can use the True value when the loop stops and enter the case or loop as desired. Hope this helps!

 

MatchPattern.jpg

 

*************************************************
CLD
*************************************************
Message 2 of 4
(8,375 Views)

Sounds like you should be using the Match First String function.

 

 

 

p.s. That AND with a constant wired to your case statement is silly.

Message 3 of 4
(8,374 Views)

Thanks, I'll give it a try.

0 Kudos
Message 4 of 4
(8,356 Views)