convert to lower ascii 128?

Alex Tweedly alex at tweedly.net
Thu Feb 5 17:41:12 EST 2009


Chipp Walters wrote:
> Ben,
> Thanks for the tests. Illuminating again. You are correct, I was actually
> running my tests on shorter strings, but hundreds of them in sequence.
>   
So it might be useful for you to try Ben's fourth (i.e. array-based) 
method, but do the set-up once using a script-local array.

If it's only a small number of hundreds of them, it may still not be 
worth the setup overhead - but may be a faster option in some cases.

   local asciiscrub
   on asciiScrub4SetUp
      set the caseSensitive to true
      -- set up array to map characters we want to retain to themselves
      put empty into asciiscrub
      repeat with i = 32 to 127
         get numtochar(i)
         put it into asciiscrub[it]
      end repeat
   end asciiScrub4SetUp

   function asciiScrub4 pText
      -- filter the string through the array set up above
      put empty into t
      repeat for each char c in pText
         put asciiscrub[c] after t
      end repeat
      return t
   end asciiScrub4


-- Alex.



More information about the use-livecode mailing list