space cannot be the itemdelimiter?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

space cannot be the itemdelimiter?

Post by dunbarx » Sun Mar 30, 2014 6:54 pm

Code: Select all

 on mouseUp
        get  "a b c"
      answer the number of words in it -- gives 3
      set the itemdelimiter to space
      answer the number of items in it gives 1
end mouseUp
Why is this?

Craig Newman

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: space cannot be the itemdelimiter?

Post by Dixie » Sun Mar 30, 2014 6:59 pm

Code: Select all

on mouseUp
   set the itemdelimiter to space
   get  "a b c"
   answer the number of words in it & cr & the number of items in it 
end mouseUp
:D

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: space cannot be the itemdelimiter?

Post by dunbarx » Sun Mar 30, 2014 7:16 pm

Never mind
Last edited by dunbarx on Sun Mar 30, 2014 7:21 pm, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: space cannot be the itemdelimiter?

Post by dunbarx » Sun Mar 30, 2014 7:19 pm

Oh hell, never mind.

How, after all these years, could I have been so careless. I wonder one what was in "it" after the "answer" command?

Ugh.

Craig

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: space cannot be the itemdelimiter?

Post by Dixie » Sun Mar 30, 2014 7:27 pm

LOL... we've all been there at one time or another... :D

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: space cannot be the itemdelimiter?

Post by dunbarx » Sun Mar 30, 2014 8:58 pm

The whole thing started in another thread where it was mentioned that the itemdelimiter was used with space. I wanted to make the point that there was a difference between that and simply counting the number of words, since adjacent spaces in the word count are ignored, whereas they are very much counted as items.

Made a quick example. That was where my brain went to sleep, though my fingers kept right on typing.

Craig

Post Reply