25 lines
1.3 KiB
Text
25 lines
1.3 KiB
Text
Module CheckThis {
|
|
Inventory Queue Haystack= "foo", "bar", "baz", "quux", "quuux", "quuuux", "bazola", "ztesch", "foo", "bar", "thud", "grunt"
|
|
Append Haystack, "foo", "bar", "bletch", "foo", "bar", "fum", "fred", "jim", "sheila", "barney", "flarp", "zxc"
|
|
Append Haystack, "spqr", "wombat", "shme", "foo", "bar", "baz", "bongo", "spam", "eggs", "snork", "foo", "bar"
|
|
Append Haystack, "zot", "blarg", "wibble", "toto", "titi", "tata", "tutu", "pippo", "pluto", "paperino", "aap"
|
|
Append Haystack, "noot", "mies", "oogle", "foogle", "boogle", "zork", "gork", "bork"
|
|
\\ Print all list
|
|
Print Haystack
|
|
\\ inventory queue can get same keys
|
|
\\ inventory use hashtable.
|
|
\\ Inventory put same keys in a linked list, so we can found easy
|
|
Do
|
|
Input "Word to search for? (Leave blank press enter to exit) ", needle$
|
|
if needle$="" then exit
|
|
n=1
|
|
s$=lcase$(needle$)
|
|
While exist(Haystack, s$, n)
|
|
\\ number, key and position (zero based convert to one based)
|
|
Print n, Eval$(HayStack!), Eval(HayStack!)+1
|
|
n++
|
|
End While
|
|
If n=1 Then Print needle$;" not found"
|
|
Always
|
|
}
|
|
CheckThis
|