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.
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to