> > -- > > -- regex method > > -- > > function trim pText > > get replaceText(pText, "^\s+", empty) > > return replaceText(it, "\s+$", empty) > > end trim > > For an easy "trim" function that is just as fast as regex, try this: > > return word 1 to -1 of pText
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 Jacque's works well so long as there are no non-breaking spaces involved in the text you're looking at (which is 99.9% of the time, I'd guess). The advantage of regex is that .01% where you want to make sure you get every kind of whitespace character included in the trim... So I'm apt to use Jacque's approach for most of my needs, and only use the regex Trim when I suspect there may be non-breaking spaces involved. Personally, I think that functions like Trim are so useful, that they *should* be in Transcript, even if we can do it ourselves. Ken Ray Sons of Thunder Software Email: [EMAIL PROTECTED] Web Site: http://www.sonsothunder.com/ _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
