Hi Dick, I found the char was getting off by 1 each line because of the EOL returns. Here is a regex to strip the EOL returns.
put replacetext(theData,"[\0\cM\r\f\n]","") into theData and then here is some code to put the EOL returns back. put theData into tString --put fld id 1022 into tString put number of chars in tString into tChars put tChars / 72 into tLineNums put the round of tLineNums into tLineNums put 72 into i repeat for tLineNums times put return after char i of tString add 72 to i end repeat put tString into fld id 1022 end if I am sure this code can be improved but it does work. Of course the variables need to be renamed to work with the code you have posted. Thanks again, it is a great help. John Balgenorth On Sep 27, 2014, at 1:49 AM, Dick Kriesel <dick.krie...@mail.com> wrote: > On Sep 27, 2014, at 12:23 AM, JB <sund...@pacifier.com> wrote: > >> But there might be a faster way. > > Hi, John. > > Here's a way that works in under a millisecond on my iMac, and a way to test > its speed. > > command replace_maybe @rString > repeat with i = 3 to length( rString ) step 3 > if char i of rString is "D" then > put "+" into char i of rString > end if > end repeat > end replace_maybe > > on mouseUp > local tString, tMilliseconds > repeat 1000 -- strings > put empty into tString > repeat 10000 -- characters > put any char of "abcdef" after tString > end repeat > subtract the long milliseconds from tMilliseconds > replace_maybe tString > add the long milliseconds to tMilliseconds > end repeat > answer "milliseconds per string:" && tMilliseconds / 1000 > end mouseUp > > How's that, John? > > -- Dick > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode