On 13 Apr 2005, at 18:09, Trevor DeVore wrote:
No offence, but this won't strip whitespaces at both ends of a string in one pass.I use this regex to strip whitespace:
get replaceText(pString, "^[ \t\r\n]+|[ \t\r\n]+$", "")
And it is about ten times slower for one pass than: get word 1 to -1 of pString
(which does strip leading and ending whitespaces in one pass, but true it is no regex).
None taken. Your're right. I put that together using my ltrim and rtrim functions and didn't test it. I think the correct regex syntax should be something like this:
get matchText(pString, "(?s)^[ \t\r\n]+(.*?)[ \t\r\n]+$", tReturnVal)
This will strip leading and trailing whitespace from a multiline string. But given that you say that word 1 to -1 is that much faster I am going to switch to that. Those of us still trying to break away from our previous languages like to complicate things on occasion ;)
Is there a way to do ltrim (trim whitespace on left of string) in plain transcript? Right now I just use:
function str_lTrim pString
get replaceText(pString, "^[ \t\r\n]+", "")
return it
end str_lTrim
-- Trevor DeVore Blue Mango Multimedia [EMAIL PROTECTED]
_______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
