Determine if string is in string table

Is there a command that returns a boolean that checks to see if a string exists in a string table?

In php, there is a function array_value_exists($search_value) that return a boolean. I’m looking for something similar in OptoScript

If not, what would be a quick way to determine if a string exists in a string table?

Assuming you already have the table length, in some optoscript…

SetVariableFalse(mystringresult);
For x = 0 to tablelength-1 step 1
If (stringtable[x] == stringtosearch) then
SetVariableTrue(mystringresult);
Endif
Next

If (mystringresult <> 0) then
//do something here if string found
Else
//do something here is string not found
Endif

I hope this helps
Nick

Hi OptoFans,

Recently I had a similar question where the customer had a very large string table to search. While his logic was fast on SoftPAC, he wanted similar logic running on a SNAP-PAC-R1 which was limited in speed and memory.

By storing that data in a text FILE, the search was much faster (e.g. roughly an order of magnitude) and he could also use a much bigger list of strings to search by skipping the string table and just using a file to store those strings!

Example charts coming soon…

-OptoMary