itemDel

David Vaughan drvaughan55 at mac.com
Wed Jul 31 06:18:01 EDT 2002


On Wednesday, July 31, 2002, at 08:42 , Yves Coppé wrote:

> Hi,
>
> is it possible to write a function which should extract an item of a 
> list BUT the itemDel should be, NOT one Char, but a charset of 3 chars !

Yves

Is the real problem here the fact that you _must_ use the 
three-character delimiter? Otherwise you could just take a copy of the 
data and use
   replace "*$*" with comma in dataCopy
then access items as usual.

However, while the documentation says "The itemDelimiter is a single 
character" you can in fact set it to a string as long as you capture a 
little problem in the result.

For example, if your delimiter were "BOO" and the string Fred contains 
"OneBOOTwoBOOThreeBOOFour" then the code
   set itemDelimiter to "BOO"
   put char 3 to -1 of item 2 of Fred
produces "Two", as you desire.
Note that I stripped the first two characters in the answer. The item 
separates at the first character of the string set as the itemDelimiter. 
If you just said "put item 2 of Fred" then it would return "OOTwo"

Two issues though:
1. As it is undocumented, it may not be supported in a future version 
unless RunRev says it is OK (...?)
2. Your example string "*$*" did not work when I tried it, possibly 
because it is being treated as a regular expression after the first 
character (speculation).

So, the first method, using <replace> works most comfortably.

Hope one of these works for you.

regards
David
>
> my list :
>
> one*$*Two*$*Three*$Four
>
> I'd like to get item 3 with is "Three"
> In this case the itemdel is "*$*"
>
> thank you
> -- Greetings.
>
> Yves COPPE
>
> Email : yvescoppe at skynet.be
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the Use-livecode mailing list