Problem with itemOffset() [SOLVED]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Problem with itemOffset() [SOLVED]

Post by atout66 » Sat Apr 05, 2014 8:26 am

Hi to all,

Look at my code below, and try it in the commandWindow:

Code: Select all

put "603+,115,603,107,116" into laList
put "603" into leTest
answer itemOffset(leTest,laList)
You get "1" instead of "3".

Any idea how I could optimize this code ?

Kind regards.
Last edited by atout66 on Sat Apr 05, 2014 8:45 am, edited 1 time in total.
Discovering LiveCode Community 6.5.2.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Problem with itemOffset()

Post by Simon » Sat Apr 05, 2014 8:32 am

put "603," into leTest
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Problem with itemOffset()

Post by bn » Sat Apr 05, 2014 8:33 am

Hi atout,
put "603+,115,603,107,116" into laList
put "603" into leTest
answer itemOffset(leTest,laList)
add "set the wholeMatches to true"

Code: Select all

 put "603+,115,603,107,116" into laList
   put "603" into leTest
   set the wholeMatches to true
   put  itemOffset(leTest,laList) into field 1
KInd regards
Bernd

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Re: Problem with itemOffset()

Post by atout66 » Sat Apr 05, 2014 8:44 am

add "set the wholeMatches to true"
You've got it Bernd :wink:
For a beginner like me, I could not guess such subtlety.
I'm sure some others will be glad to notice this trick...

Thanks to all of you.
Discovering LiveCode Community 6.5.2.

Post Reply