Not shy at all...

Alex Tweedly alex at tweedly.net
Sun Jun 6 18:00:28 EDT 2004


At 13:45 06/06/2004 -0700, Jeanne A. E. DeVoto wrote:

>At 9:55 AM -0700 6/6/2004, Bob Nelson wrote:
>>Two fields and two buttons so I can work through the example - the first
>>field is the 'holder' of the remote URL which has been retrieved
>>(Imported_Raw) and the second field will be the restructured output when I'm
>>done.
>>
>>Here's the code, for those who want to dive deeper...
>[...]
>
>Using replace (instead of looping through each line) will be quite a lot 
>faster:
>
>on mouseUp
>   put field "Imported_Raw" into rawText -- manipulations are much faster 
> in variables
>   repeat while return & return is in rawText
>     replace return & return with return in rawText -- nuke blank lines
>   end repeat
>   repeat while return & space is in rawText
>     replace return & space with return in rawText -- nuke leading space
>   end repeat
>   put rawText into field "Imported_Raw"
>end mouseUp

Since I brought up Regular Expressions, I have to suggest:

on mouseUp
   put field "Imported_Raw" into rawText
   put replaceText(rawText, "\n+ *", cr) into field "Imported_Raw"
end mouseUp

Should be even faster than two replace loops

But the HTMLText technique looks much better :-)

-- Alex Tweedly.
btw - thanks Jeanne - I had done the search - but inside Transcript 
Dictionary, instead of in the whole doc. set - my mistake.
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.699 / Virus Database: 456 - Release Date: 04/06/2004


More information about the use-livecode mailing list