Thierry,

If you have very large text variables and are searching the lines many times, you may want to consider using "repeat for each", which will avoid the problem of searching from the beginning of the string each time.

put 1 into i
repeat for each line theLine in text2lookAt
   if (theLine contains "String2Find") then
      put i into idx
      ...
   end if
   add 1 to i
end repeat

OR... if you don't mind using offset() instead of lineOffset(), it will work much faster. This is because chars are fixed size (whereas lines are not), so using the optional offset to skip is very fast- it just jumps immediately that many bytes into the string instead of counting off lines. Of course if what you really need is the line number, this won't help you too much because you'll still have to count off the line number somehow.

Lastly, if your search is simple enough and you don't need line numbers, you could try using the "filter" command.

HTH,

Brian

in fact, one can use :
put lineoffset( CR & "String2Find", text2lookAt, skippedLines ) into idx


it works well !

but the problem i found then is the time expanding when the text2lookAt
starts to grow... did the test with 900 Kb of text...

So, instead of using skippedLines, i delete the line 1 to the 'idx' line
of the text2lookAt; get better result but still, not very fast. it seems
that the delete build in function has a strange behavior; very fast at
the beginning of the text and more and more we go to the end of the text,
increase drastically in time ( delete more or less the same size ).

_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to