Functions and repeat for each

ron barber rbarber at yhb.att.ne.jp
Tue Jun 7 08:24:47 EDT 2005


Hi,

In an effort to speed up a process of importing, converting and htmling 
some text I ran across this unexpected (to me) result:

put uniencode(return,"Japanese") into unireturn
repeat for each line l in thetext
    put uniencode(l,"Japanese")&unireturn after newtext
end repeat
  set the unicodetext of fld "Utext"  to newtext

is much much faster as the size of thetext gets large than:

set the unicodetext of fld "Utext"  to uniencode(thetext,"Japanese")

This seems also to be true of the replacetext function as of 2.5 (I 
haven't tried the reportedly improved 2.6 yet)
viz. This:
repeat for each line l in thetext
    put replacetext (thetext,oldword,newword)&return after newtext
end repeat

is faster than:
put replacetext (thetext,oldword,newword)&return into newtext

when thetext is very large.

Why is this true and is it generally known and I just missed it?

thanks
Ron



More information about the use-livecode mailing list