Put data in lines

Jim Ault JimAultWins at yahoo.com
Sat May 5 12:56:57 EDT 2007


> A problems with using arrays like that is that i will shuffle the lines
> around somewhat randomly. Also note that my approach is about 7 times
> faster (not sure if it's the itemDelimiter stuff, or the array handling
> itself that is slower).

I find that the array method as shown by Mark will work a bit faster than
the replace delimeters method, but you have to use a data list of about
10,000 to see the difference.  At 50000 lines of data, the replace takes
9-10 ticks, and the array method takes 6-7 ticks.  At 4000 lines, both will
show 0 ticks elapsed, which means less than half a tick.  Tick is about
1/60th of a second.

Mac G5 Duo, Rev 2.7.2 build 261

Jim Ault
Las Vegas


On 5/5/07 9:28 AM, "Björnke von Gierke" <bvg at mac.com> wrote:

> I always found arrays to be confusing, that's why I prefer this method :
> 
> on mouseUp
>    put "Arb.rec:0=234:1=456789:2=657483:3=4:4=3456473:5=1:6=0: " & CRLF
> into x
>    replace ":" with return in x
>    replace "=" with space in x
>    put line 2 to -2 of x
> end mouseUp
> 
> A problems with using arrays like that is that i will shuffle the lines
> around somewhat randomly. Also note that my approach is about 7 times
> faster (not sure if it's the itemDelimiter stuff, or the array handling
> itself that is slower).
> 
> have fun
> Björnke
> 
> On 05 May 2007, at 16:46, Mark Smith wrote:
> 
>> This works for the given string, and should be quick even with 999
>> values:
>> 
>> on mouseUp
>>   put "Arb.rec:0=234:1=456789:2=657483:3=4:4=3456473:5=1:6=0: " & CRLF
>> into tRec
>>   set the itemDelimiter to ":"
>>   delete item 1 of tRec
>>   delete item -1 of tRec
>> 
>>   split tRec by ":" and "="
>>   combine tRec by cr and space -- (or tab, if you prefer)
>>   put tRec
>> end mouseUp
>> 
>> Best,
>> 
>> Mark
>> 
>> On 5 May 2007, at 11:18, Camm29 wrote:
>> 
>>> Hi ,
>>> 
>>> I'm using read from socket
>>> 
>>> example reply , can be max 999 values.
>>> 
>>> 
>>> Arb.rec:0=234:1=456789:2=657483:3=4:4=3456473:5=1:6=0: CRLF
>>> 
>>> I wish to display in a updating field with the values shown as ,
>>> 
>>> 0    234
>>> 1    456789
>>> 2    657483
>>> 3    4
>>> 4    3456473
>>> 5    1
>>> 6    0
>>> 
>>> I must be missing something , i used a repeat but its very slow on
>>> updating ?
>>> 
>>> Thanks in advance
>>> Camm





More information about the use-livecode mailing list