convert to lower ascii 128?
Devin Asay
devin_asay at byu.edu
Thu Feb 5 10:15:18 EST 2009
On Feb 4, 2009, at 6:45 PM, Chipp Walters wrote:
> Interesting note: I found the following results:
> function altAsciiScrub2 pText
> put replacetext(pText,"[" & numToChar(129) & "-" & numToChar(255) &
> "]","") into pText
> put replacetext(pText,"[" & numToChar(1) & "-" & numToChar(31) &
> "]","")
> into pText
> return pText
> end altAsciiScrub2
>
> executed in 19 ticks on my QuadCore Vista 64 machine
>
> function altAsciiScrub1 pText
> repeat for each char c in pText
> get charToNum(c)
> if it > 128 or it < 32 then
> next repeat
> end if
> put c after t
> end repeat
> return t
> end altAsciiScrub1
>
> executed in 17 ticks on my QuadCore Vista 64 machine
>
> repeat for each is really fast.
>
> That said, executing one replaceText versus a single "if it >128
>
> (Devin, yours was much slower: 49 ticks)
Wow! What a testimonial to the speed of repeat for each. I have to
think that the text you're "scrubbing" is longer than 128 chars.
Devin
Devin Asay
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode
mailing list