Page 1 of 1

How to find the index of specific word?

Posted: Thu Oct 13, 2022 9:18 pm
by royF
How to find the index (number) of specific word?

Code: Select all

put any word of "Easy Medium Hard Extreme" into game_level
answer the num of the word game_level of "Easy Medium Hard Extreme"  ----> Don't work!

Re: How to find the index of specific word?

Posted: Thu Oct 13, 2022 9:28 pm
by Klaus
Hi royF,

use OFFSET for something like this, and here especially -> WORDOFFSET

Code: Select all

...
## Save typing by putting this string into a variable!
put "Easy Medium Hard Extreme" into tLevels
put any word of tLevels into game_level
put wordoffset(game_level,tLevels) into tNumOfWord
answer tNumOfWord
...
Check also "wholematches" in the dictioanry, important for any kind of OFFSET.

We also have itemoffset, offset (= character offset), lineoffset and some more.
Enter OFFSET in the dictionary to see all of them.

Best

Klaus

Re: How to find the index of specific word?

Posted: Thu Oct 13, 2022 9:33 pm
by royF
Amazing! Thanks!!