need something faster
need something faster
- Subject: need something faster
- From: Hudson Barton <email@hidden>
- Date: Sat, 4 Jun 2005 07:49:18 -0400
What the following handler does is clean up a text string that
contains unwanted characters and formats the result with regular line
endings. It is way too slow when processing a long string. Any
suggestions?
H.
on cleanup(dirtytext)
set i to 1
set ct to length of dirtytext
set cleantext to ""
set r to 1
repeat with i from 1 to ct
if character i of dirtytext is in "ABCDEF1234567890" then
set cleantext to cleantext & (character i of
dirtytext) as string
set i to (i + 1)
if r = 40 then
set cleantext to (cleantext & (ascii
character 10)) as string
set r to 1
else
set r to (r + 1)
end if
end if
end repeat
if last character of cleantext is not (ascii character 10)
then set cleantext to cleantext & (ascii character 10)
return cleantext
end cleanup
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden