AW: How trim?

Thomas Fischer fischer at mail.sub.uni-goettingen.de
Sat Oct 22 12:00:47 EDT 2005


Hi Bob,

this is a classical application of regular expressions. Try

get replaceText("        The cat sat under 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 under the mat.         "," *$","")

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

All the best
Thomas


--
Thomas Fischer
Salzburg 

> -----Ursprüngliche Nachricht-----
> Von: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com]Im Auftrag von Bob
> Warren
> Gesendet: Samstag, 22. Oktober 2005 17:05
> An: Marcus van Houdt; use-revolution at lists.runrev.com
> Betreff: Re: How trim?
> 
> 
> Thanks a lot, Marcus.
> The double trim is easy as you say, but I would never have guessed it.
> However, by what I see from Alex Tweedly's first ideas about left and 
> right trims, these may not be so trivial. Any ideas about simple 
> solutions for these cases?
> 
> Alex:
> 
> I couldn't seem to make your first suggestions for L and R trims work. 
> Would you mind spelling out some example routines for me?
> 
> Best,
> Bob
> 
> ------------------------------------------------
>  >Hello,
> 
>  >With revolution this is even easier than Basic, all you need to do is:
> 
>  >put word 1 to -1 of "        The cat sat under the mat.         "
> 
>  >This will put "The cat sat under the mat." into message.
> 
>  >Regards,
> 
>  >Marcus
> 
>  >Software Developer
>  >Runtime Revolution
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list