itemoffset & wholematches

jbv at souslelogo.com jbv at souslelogo.com
Mon Nov 14 07:51:16 EST 2022


Hi list,

I have a variable with a content of 3 lines as follows :
1	sombre	brun	profond
2	flou	incertain
3	inexploré	mystérieux	inconnu

The separator between words is tab.
I want to check if a certain word is among the items as a whole.

The following script returns "6" :
    set itemdel to tab
    set the wholematches to false
    put itemoffset("incertain",myVar)

The following script returns "0" :
    set itemdel to tab
    set the wholematches to true
    put itemoffset("incertain",myVar)

The following script returns "7" :
    set itemdel to tab
    set the wholematches to true
    replace return with tab in myVar
    put itemoffset("incertain",myVar)

Scripts 1 & 3 are logical, but any logical explanation
for the result of script 2 ? Does it mean that the return
char after the word is considered as part of the word ?

Thanks in advance.
jbv



More information about the use-livecode mailing list