How to delete trailing spaces in a line

Jim Ault JimAultWins at yahoo.com
Tue Oct 24 13:41:59 EDT 2006


On 10/24/06 9:49 AM, "Mark Powell" <mark_powell at symantec.com> wrote:

> Thanks for the reply, Mark.  However, it must be at the end of line
> only.  In addition, I need to do the operation on a container in one
> call, preferably using replaceText.  I am having problems with
> 
> ...
> put space & "+" & return into vStringToStrip
> replaceText(vMyContainer,vStringToStrip,empty)
> ...
> 
Try this 

   put " +"&cr into regEx
  put line 1 to -1 of replaceText( vMyContainer&cr, regEx, cr) into
vMyNewContainer


--use the space+cr that you did before
-- vMyContainer&cr allows the last line to be a 'hit/match'
-- line 1 to -1  effectively deletes the trailing cr you don't want, but be
careful in the case that the last line of vMyContainer is actually empty and
you want to preserve this

Hope this helps

Jim Ault
Las Vegas


> 
> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Mark Smith
> Sent: Tuesday, October 24, 2006 10:03 AM
> To: How to use Revolution
> Subject: Re: How to delete trailing spaces in a line
> 
> put word 1 to -1 of tLine into tLine - though this will also remove
> spaces at the beginning of the line.
> 
> 
> Best,
> 
> Mark
> 
> On 24 Oct 2006, at 17:10, Mark Powell wrote:
> 
>> I want to delete all spaces at the end of a line, be they a single
>> space or a couple dozen.  What is the best way to do this?
>> 
>> Mark Powell
>> _______________________________________________
>> 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
> 
> _______________________________________________
> 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