Is there a requirement for the solutions to be one liners?
I think the following 2 are faster than any solutions using
replaceText, and more readable too.
function trimL pString
put " " & tab & return into x
repeat while char 1 of pString in in x
delete char 1 of pString
end repeat
return pString
end trimL
function trimR pString
put " " & tab & return into x
repeat while char -1 of pString in in x
delete char -1 of pString
end repeat
return pString
end trimR
The following is not as fast as "return word 1 to -1 of ....", but
it's less than twice as slow. And it makes it easy to modify which
whitespace characters to remove.
function trim pString
put " " & tab & return into x
repeat while char 1 of pString in in x
delete char 1 of pString
end repeat
repeat while char -1 of pString in in x
delete char -1 of pString
end repeat
return pString
end trim
Cheers
Dave
_______________________________________________
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