Re: [Clip] Re: Remove Adjacent Blanks
- Thanks Alan,
It was interesting to see a regex solution. I am just learning regex.
----- Original Message -----
From: "Alan C." <acumming@...>
Sent: Wednesday, June 23, 2004 12:34 AM
Subject: Re: [Clip] Re: Remove Adjacent Blanks
shift + f12
and look VERY closely at the clip. Been lots trouble lately with character
26 masquerading as a space character (happens in the email).
^!Replace "\s+" >> "\s" AISHR
If your string originates from a doc then the above clip works; it uses
To test, have your "line" variable string as a line in a doc then click
cursor on that line then run the enclosed clip.
As to how you were doing it, operating on a variable's content, Ntab regex
cannot work directly on the content of a variable.
Some things are easier right directly work the doc. Some things are easier
right directly work on the content of a variable.
More elegant? I thought that your clip was rather elegant. It worked very
fine. How can you get any better or more elegant than that?
Ease of construction and ease of use and efficiency are important to me.
If I was sourcing from a doc and needed to work on a line or a few lines, I
would do the regex above.
Thanks for showing me an elegant clip that worked so well. You did it your
way. I did it my way.
On Tue, 22 Jun 2004 18:51:48 -0500, Roy Herring wrote:
> I only want to do it for one line, not the whole file.
> It is w/i the logic of a clip (retrieving some lines and removing the
[ . . ]
>> --- In firstname.lastname@example.org, "Roy Herring" <roynancy@e...> wrote:
>> > I had to write a loop to remove adjacent blanks from a field.
>> > Can anyone think of a more elegant way?
>> > Thanks,
>> > Roy
>> > My clip:
>> > H="RemoveAdjacentBlanks"
>> > ^!Set %Line%=1 2 3 4 5
>> > :LoopRemove
>> > ^!Set %Z%=^$StrPos(" ";^%Line%;False)$
>> > ^!If ^%Z% <> 0 ^!Set %Line%=^$StrReplace(" ";" ";"^%
>> > ^!If ^%Z% <> 0 ^!Goto LoopRemove
>> > ^!Info ^%Line%
Yahoo! Groups Links