How trim?
Jim Ault
JimAultWins at yahoo.com
Sat Oct 22 22:30:59 EDT 2005
True, but padding at each end should fix this.
get replaceText(space &" The cat sat on the mat. "&space,"^
*","")
Jim Ault
Las Vegas
On 10/22/05 2:17 PM, "Buster" <wouter.abraham at scarlet.be> wrote:
> It is indeed elegant, but a condition check is necessary here as it
> will remove the first word + the space(s) if there is no space at the
> start of the line.
>
>> " The cat sat on the mat. "
> will become
> " The cat sat on the mat. "
> But if no space in front the result is
> "cat sat on the mat. "
>
> On 22 Oct 2005, at 22:41, Bob Warren wrote:
>
>> 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.....
>> ------------------------------------------
>>> 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.
>>
>> _______________________________________________
>> 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
>>
>
> _______________________________________________
> 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