On Sunday, September 28, 2003, at 06:48 PM, Ken Ray wrote:

Interesting... my regEx version of Trim was this:

function Trim what
  local tText
  get matchText(what,"(?s)\s*(\S.*\S)\s*",tText)
  return tText
end Trim

Beware this function fails for single-character-with-whitespace strings like " s" and " 9 ". By changing the regex to "(?s)\s*(\S.*\S?)\s*" and checking the result of matchText(), we can make it safer. But it still was failing some of my tests- I can't remember which strings though.



Alex Rice <[EMAIL PROTECTED]> | Mindlube Software | http://mindlube.com


what a waste of thumbs that are opposable
to make machines that are disposable  -Ani DiFranco

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to