repeat . . . delimit by

J. Landman Gay jacque at hyperactivesw.com
Sun Sep 15 13:30:40 EDT 2013


On 9/15/13 11:03 AM, Dr. Hawkins wrote:

> If I have strng containing
>
>      A B C<tab>1 2 3
>
> then
> set the itemDel to tab
> repeat for each item itm in strng
> put itm
> set the itemDel to space
> put item 1 of itm
> next repeat
>
> Will put out
> A B C
> A
>
> For the first iteration, but
>
> 1
> 1
>
> for the second--it takes up parsing from the same point, but with the new
> itemdDel
>

If your second delimiter really is a space, then the simple solution is 
to use "word" instead of "item" inside the loop. Otherwise you can just 
do a replace like this:

set the itemDel to tab
repeat for each item itm in strng
   replace vtab with tab in itm
   put item 1 of itm
end repeat

I think in this case it isn't necessary to store itm in a temp variable 
  since nothing else is done with it, but check.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list