NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Dumb TestStand Newbie question - can search a string array?

Any help appreciated...

 

I have an array of strings.

 

Is there a TestStand (v4.1) function that will search the array for a given string and return the element number of the array location that holds the string - if it exists in the array?

 

If not I'll stick to a for loop.

 

Thanks

Alan

0 Kudos
Message 1 of 4
(6,059 Views)

Hi,

 

There isn't a function that will search your array in one hit. You will have to index through each element of the array.

 

Check out the inbuilt functions in the expression browser, you will find the Find function

 

Find(string, stringToSearchFor, <indexToSearchFrom>, <ignoreCase>, <searchInReverse>)

 

You will have to change the string parameter for your property or variable holding your string value.

eg 

Find(Locals.MyStrArray[Locals.Index], "MySearchStr")

 

 

Regards
Ray Farmer
0 Kudos
Message 2 of 4
(6,056 Views)

Thanks for your prompt reply

0 Kudos
Message 3 of 4
(6,054 Views)

It might be faster to create a simple action that will input your string and a regular expression to look for a pattern in your string.

0 Kudos
Message 4 of 4
(6,002 Views)