Behavior Control
This control is developed by:
AvatarDJ Sures
Created December 29 2018
Updated December 29 2018
Help Index


How To Download and Use This Control

  1. Make sure you have the latest version of EZ-Builder installed.
  2. Select Download This Control button below to download the file.
  3. Double click the downloaded file to open it.
  4. The installer will automatically add this control to EZ-Builder.
Download This Control

Adds a new EZ-Script function GetLineContainingFromArray() that will return an item from the array that contains the specified text. The syntax of the function is...


GetLineContainingFromArray("$array", "Txt to search for")

An example is as such...


# Fill an array with the word "Banana" 20 times
defineArray($array, 20, "Banana")

# set the 5th index to these words
$array[5] = "Apple face"

# get the first line containing the text "apple"
$x = GetLineContainingFromArray("$array", "apple")

print("Found: " + $x + " Among the bananas")

Source Code

You can download the source code here:

DJ Sures
December 29 2018
Have you tried loading each line into an array? That way you can simply loop through the array rather than looping through the file. 

Reading from a file that way is indeed slow - as you’re not noticing:). Memory is much faster. Much much faster
December 29 2018 — Updated December 29 2018
Thanks DJ! I gave it a try and I think I must be doing something wrong, because according to the output timestamp, reading from an array isn't always faster than reading from the file. Here is my code (*note, "$dictionary_a" is an array containing 7236 strings, which I created in a different script):


IF (contains($dictionary_a[$lookUpIndex],$target))
  $match=split($line, " ",0)
IF (Length($match)=Length($target))
  print("On line " +$lookUpIndex +", line reads: "+$line)
IF ($lookUpIndex<7236)
  print("Not in dictionary")

Timestamp for reading from array    (00:00:02.4314810)
Timestamp for reading from text file (00:00:01.7622398)

I know I must be doing something very inefficient, just not sure what!:)

DJ Sures
December 29 2018
Here, try this plugin

Put all your data in the array and rock that function. The source code is available for the plugin if you need to modify it
December 29 2018 — Updated January 4

So this plugin really is a game changer for searching vast amounts of info stored in arrays. I reorganized the entire dictionary to rank order from shortest character length strings to longest, and alphabetically as a second order rank. Now when I use the search function, i immediately get the result i want from the array, and i don't need to do any matching or verification, which speeds it up even more. I initially ran into an issue where a shorter word like "space" was contained in a longer word, like "aerospace", but rank ordering the input solved that issue. My execution time went from ~1.5s for short strings "8 words", to 0.16s!!! Immense difference. Now the votrax is by far the slowest part of the system (as it should be).

@DJ Sures, you have created a fantastic product that continues to impress me the more I use it!! Thank you!!!
DJ Sures
January 4
Hey GBot, thanks for the kind words! I'm really glad this plugin is working for you - and access to the source code means you can make any necessary changes to it:D