Manipulating large qtys of text
Geoff Canyon
gcanyon at inspiredlogic.com
Wed May 15 16:19:01 EDT 2002
At 10:37 AM -0600 5/15/02, Barry Levine wrote:
>Okay, let's assume I don't want to use Valentina and want to keep everything "inside" Revolution. What are the practical limitations to the length of text fields? For example: I have a field with 5000 lines of text (tab-delimited). Let's assume that the itemDelimiter is already "tab". The first item in each line is a number. I want to renumber the lines sequentially.
At 8:50 PM +0200 5/15/02, Ludovic Thébault wrote:
>set the itemDelimiter to tab
>set the lockScreen to true
>set the lockMessages to true
>put field myField into var
>put 0 into tNum
>repeat for each line l in var
>add 1 to tNum
> put tNum into item 1 of line tNum of var
>end repeat
>put var into field myField
The above still forces Revolution to figure out where each line of the variable is in order to insert the modified line. At the cost of extra memory, this will be much faster (factor of 40 for 5000 lines on my machine):
set the itemDelimiter to tab
put field 1 into tVar
put empty into tNewVar
put 0 into tNum
repeat for each line L in tVar
add 1 to tNum
put tNum & tab & (item 2 to -1 of L) & cr after tNewVar
end repeat
put char 1 to -2 of tNewVar into field 1
--
regards,
Geoff Canyon
gcanyon at inspiredlogic.com
More information about the use-livecode
mailing list