words matter

Jim Ault jimaultwins at yahoo.com
Fri Sep 4 17:13:06 EDT 2009


I think the rationale is that there is no single character to delimit  
words, but rather many possibilities.
  [ space tab space.space.tab.space  space.cr.space.cr.cr ]

In the docs
Comments:
A word is delimited by one or more spaces, tabs, or returns, or  
enclosed by double quotes. A single word can contain multiple  
characters and multiple items, but not multiple lines.

so using
>> put empty into myText
>> put "aa" into word 1 of myText
>> put "bb" into word 2 of myText
>> answer myText


does not really define exactly which separation character or  
characters to use.
There is no wordDelimiter.

Try this riddle

on testt
    put "thisisa" & cr & "wordOnLine1" into wordz
    put word 1 of wordz
    set the lineDelimiter to Z
    put cr & cr after msg

    put word 1 of wordz after msg
    put cr & cr after msg
    put "thisisaZtimeforallofus" into wordz
    put word 1 of wordz after msg

    put cr & cr after msg
    put line 1 of wordz after msg

end testt

Conclusion is that you can change the lineDelimiter to 'Z' and get a  
different line chunk than cr,
but this does not change the definition of a word when it comes to a cr.
Thus a cr IS always a word separator, but a cr CAN BE a line delimiter.

Hope this helps.

Jim Ault
Las Vegas

On Sep 4, 2009, at 1:30 PM, Jim Bufalini wrote:

> François Chaplais wrote:
>
>> Is this perfectly rational (revolution-wise of course)?
>>
>> If I do
>>
>> put empty into myText
>> put "aa" into item 1 of myText
>> put "bb" into item 2 of myText
>> answer myText
>>
>> I get (as expected)
>> "aa,bb"
>>
>> while, if I do
>>
>> put empty into myText
>> put "aa" into word 1 of myText
>> put "bb" into word 2 of myText
>> answer myText
>>
>> I get
>> "aabb"
>> (while I would expect "aa bb").
>>
>> ?
>>
>>
>> this is revStudio 3.5 gm-2 (and maybe my brains are still in HC)
>
> I've confirmed this. Maybe not rational, perfectly or otherwise. ;-)  
> But, as
> a simple work around, you can:
>
> set itemdel to space
> put "aa" into item 1 of myText
> put "bb" into item 2 of myText
>
> And you will get "aa bb"
>
> Then put word 1 of myText into myWord will give you "aa"
>
> Aloha from Hawaii,
>
> Jim Bufalini
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

Jim Ault
jimaultwins at yahoo.com






More information about the use-livecode mailing list