itemoffset & wholematches

Mike Kerner MikeKerner at roadrunner.com
Mon Nov 14 13:15:52 EST 2022


that still won't work if the text is the last item of a line.
in the example, below, i've taken his original, replaced the tabs with
commas, and for the purpose of being able to read what's going on,
substituted the cr for a backslash, and added a line to substitute it back
for the test.

*put*
"1,sombre,burn,profound\2,flou,incertain\3,inexploré,mystériux,inconnu" into
 myVar

*replace* "\" with cr in myVar

*put* "profound" is among the items of myVar

On Mon, Nov 14, 2022 at 12:01 PM Bob Sneidar via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Why not just use is among the items?
>
> Bob S
>
>
> > On Nov 14, 2022, at 04:51 , jbv via use-livecode <
> use-livecode at lists.runrev.com> 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 ?
> >
> > Thanks in advance.
> > jbv
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."


More information about the use-livecode mailing list