How trim?

Bob Warren robertum at brturbo.com
Sat Oct 22 16:41:59 EDT 2005


Well, I am relieved to say it wasn't such a dumb question after all. 
Thanks chaps! And thanks particularly to Thomas Fischer who has come up 
with the most elegant solution. QED. Now I need to go off and study 
regular expressions.....

Bob
------------------------------------------
 >This is a classical application of regular expressions. Try

 >get replaceText("        The cat sat on the mat.         ","^ *","")

 >The "^" tells the search engine to start at the beginning.
 >The "*" looks for as many of the previous characters (here space) as 
 >possible.

 >To get rid of them at the end use

 >get replaceText("        The cat sat on the mat.         "," *$","")

 >The "$" tells the search engine to look at the end.




More information about the use-livecode mailing list