Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] Re: Remove Adjacent Blanks

Expand Messages
  • Roy Herring
    Thanks Alan, It was interesting to see a regex solution. I am just learning regex. Roy ... From: Alan C. To:
    Message 1 of 7 , Jun 23, 2004
    • 0 Attachment
      Thanks Alan,

      It was interesting to see a regex solution. I am just learning regex.

      Roy

      ----- Original Message -----
      From: "Alan C." <acumming@...>
      To: <ntb-clips@yahoogroups.com>
      Sent: Wednesday, June 23, 2004 12:34 AM
      Subject: Re: [Clip] Re: Remove Adjacent Blanks


      Hi,

      use

      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).

      H="RemoveAdjacentBlanks2"
      ^!Select LINE
      ^!Replace "\s+" >> "\s" AISHR
      ^!Select 0
      ; ---<end<---

      If your string originates from a doc then the above clip works; it uses
      regex.

      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.

      Alan.

      On Tue, 22 Jun 2004 18:51:48 -0500, Roy Herring wrote:
      > John,
      >
      > 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
      dups).
      >
      > Roy
      [ . . ]
      >> --- In ntb-clips@yahoogroups.com, "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(" ";" ";"^%
      >> Line%";False;False)$
      >> > ^!If ^%Z% <> 0 ^!Goto LoopRemove
      >> > ^!Info ^%Line%
      >> >





      Yahoo! Groups Links
    Your message has been successfully submitted and would be delivered to recipients shortly.