itemoffset & wholematches

J. Landman Gay jacque at hyperactivesw.com
Mon Nov 14 15:07:25 EST 2022


How about a one-liner:

put wordOffset("incertain",myVar)

If the words ever have punctuation attached, use trueWordOffset.

On 11/14/22 6:51 AM, jbv via use-livecode wrote:
> 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 ?

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list