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

Re: [Clip] trying to remove some spaces at the end of a line

Expand Messages
  • Jody
    Hi Larry, ... That s the one I was looking for, ;) except if there are spaces in front of the line it does not get them - not that it matters. I think he was
    Message 1 of 15 , Sep 5, 2000
    View Source
    • 0 Attachment
      Hi Larry,

      >^!Keyboard Alt+M L T

      That's the one I was looking for, ;) except if there are spaces
      in front of the line it does not get them - not that it matters.
      I think he was wanting 4 items per line though and the reason why
      I wrote the Clip the way I did.

      H=VBar 4
      ^!Jump 1
      ^!Set %n%=1
      ^!Select All
      ^!Keyboard Alt+M L T

      :Start
      ^!Replace "^p" >> "|" S
      ^!IfError End
      ^!Inc %n%
      ^!If ^%n% = 4 Skip
      ^!Goto Start

      ^!Set %n%=1
      ^!Jump +1
      ^!Goto Start

      Happy Clip'n!
      Jody

      http://www.sureword.com/notetab

      Subscribe, UnSubscribe, Options
      mailto:Ntb-Clips-Subscribe@...
      mailto:Ntb-Clips-UnSubscribe@...
      http://www.egroups.com/group/ntb-clips
    • Larry Thomas
      Hi Jody, ... You can modify my clip and replace the above line with: ^!Keyboard Alt+M A L Alt+M L T And it will remove spaces and tabs from both ends of the
      Message 2 of 15 , Sep 5, 2000
      View Source
      • 0 Attachment
        Hi Jody,

        At 06:54 AM 09/05/2000 -0500, you wrote:
        >
        >Hi Larry,
        >
        >>^!Keyboard Alt+M L T
        >
        >That's the one I was looking for, ;) except if there are spaces
        >in front of the line it does not get them - not that it matters.
        >I think he was wanting 4 items per line though and the reason why
        >I wrote the Clip the way I did.

        You can modify my clip and replace the above line with:

        ^!Keyboard Alt+M A L Alt+M L T

        And it will remove spaces and tabs from both ends of the selected lines.
        The advantage over ^$StrTrim()$ is that you do not have to have loops to
        process individual lines and it tends to get the job done a little simpler
        and faster.

        Regards,

        Larry
        larryt@...
      • Claes Gauffin
        Hi Don, Jody, Larry, Since the discussion seems to drift towards code efficiency, wouldn t the following be rather straightforward, eliminating at least one
        Message 3 of 15 , Sep 5, 2000
        View Source
        • 0 Attachment
          Hi Don, Jody, Larry,

          Since the discussion seems to drift towards code efficiency,
          wouldn't the following be rather straightforward, eliminating at least one
          loop?

          Regards /Claes

          ^!SetScreenUpdate Off
          ^!TOOLBAR Select All
          ^!KeyBoard ALT+M A L ALT+M L T
          ^!Jump 1
          :next_record
          ^!Replace "^p" >> "|" S
          ^!Replace "^p" >> "|" S
          ^!Replace "^p" >> "|" S
          ^!IfError End
          ^!Jump +1
          ^!Goto next_record
        • Jody
          Hi Claes and Larry, ... Your s is the shortest. ;) I still like the first one I posted though, because it does not use Keyboard; just a think with me -
          Message 4 of 15 , Sep 5, 2000
          View Source
          • 0 Attachment
            Hi Claes and Larry,

            >Since the discussion seems to drift towards code efficiency,
            >wouldn't the following be rather straightforward, eliminating at
            >least one loop?

            Your's is the shortest. ;) I still like the first one I posted
            though, because it does not use Keyboard; just a think with me -
            personal preference for the most part. I guess it sounds too
            much like having to take my hand off the mouse and actually use a
            keyboard shortcut. <g>

            H=Regards /Claes
            ^!SetScreenUpdate Off
            ^!TOOLBAR Select All
            ; compliments of Larry ;)
            ^!KeyBoard ALT+M A L ALT+M L T
            ^!Jump 1
            :next_record
            ^!Replace "^p" >> "|" S
            ^!Replace "^p" >> "|" S
            ^!Replace "^p" >> "|" S
            ^!IfError End
            ^!Jump +1
            ^!Goto next_record

            H=Jody II
            ^!Jump 1
            ^!Set %n%=1
            ^!Select All
            ^!Keyboard Alt+M L T

            :Start
            ^!Replace "^p" >> "|" S
            ^!IfError End
            ^!Inc %n%
            ^!If ^%n% = 4 Skip
            ^!Goto Start

            ^!Set %n%=1
            ^!Jump +1
            ^!Goto Start

            H=Jody I
            ^!Jump 1
            ^!Set %n%=1

            :Start
            ^!Select Eol
            ^$StrTrim("^$GetSelection$")$
            ^!Replace "^p" >> "|" S
            ^!IfError End
            ^!Inc %n%
            ^!If ^%n% = 4 Skip
            ^!Goto Start

            ^!Set %n%=1
            ^!Select Eol
            ^$StrTrim("^$GetSelection$")$
            ^!Jump +1
            ^!Goto Start

            Happy Clip'n!
            Jody

            http://www.sureword.com/notetab

            Subscribe, UnSubscribe, Options
            mailto:Ntb-Clips-Subscribe@...
            mailto:Ntb-Clips-UnSubscribe@...
            http://www.egroups.com/group/ntb-clips
          • Larry Thomas
            Hi Claes, ... My math is probably off (I used to be a bookkeeper) but I count 11 lines of code above as compared to five lines below and there are no loops in
            Message 5 of 15 , Sep 5, 2000
            View Source
            • 0 Attachment
              Hi Claes,

              At 04:05 PM 09/05/2000 +0200, you wrote:
              >
              >Hi Don, Jody, Larry,
              >
              >Since the discussion seems to drift towards code efficiency,
              >wouldn't the following be rather straightforward, eliminating at least one
              >loop?
              >
              >Regards /Claes
              >
              >^!SetScreenUpdate Off
              >^!TOOLBAR Select All
              >^!KeyBoard ALT+M A L ALT+M L T
              >^!Jump 1
              >:next_record
              >^!Replace "^p" >> "|" S
              >^!Replace "^p" >> "|" S
              >^!Replace "^p" >> "|" S
              >^!IfError End
              >^!Jump +1
              >^!Goto next_record

              My math is probably off (I used to be a bookkeeper) but I count 11 lines of
              code above as compared to five lines below and there are no loops in either
              clip.

              ^!IfTrue ^$IsEmpty(^$GetSelection$)$ Next Else Skip_2
              ^!Info Nothing is selected.
              ^!Goto Exit
              ^!KeyBoard ALT+M A L ALT+M L T
              ^!Replace ^p >> | TASH

              If you want to assume that he wants to always process the whole file you
              can chop it down to three lines.

              ^!Select All
              ^!KeyBoard ALT+M A L ALT+M L T
              ^!Replace ^p >> | TASH

              As for keyboard commands, I prefer to avoid them myself but when it saves
              this much typing I definitely will use them.

              Regards,

              Larry
              larryt@...
            • Craig
              ... Howdy, All - Just to add one more, since I didn t see any regex es :-) H= nospace 2 pipe ... ^!Set %i%=1 ... ^!IfError End ^!Replace s* n
              Message 6 of 15 , Sep 5, 2000
              View Source
              • 0 Attachment
                --- In ntb-clips@egroups.com, Jody <KJB1611@a...> wrote:
                > Hi Claes and Larry,
                >
                > >Since the discussion seems to drift towards code efficiency,
                > >wouldn't the following be rather straightforward, eliminating at
                > >least one loop?
                >
                > Your's is the shortest. ;) I still like the first one I posted
                > though, because it does not use Keyboard; just a think with me -
                > personal preference for the most part. I guess it sounds too
                > much like having to take my hand off the mouse and actually use a
                > keyboard shortcut. <g>
                >
                > H=Regards /Claes
                > ^!SetScreenUpdate Off
                > ^!TOOLBAR Select All
                > ; compliments of Larry ;)
                > ^!KeyBoard ALT+M A L ALT+M L T
                > ^!Jump 1
                > :next_record
                > ^!Replace "^p" >> "|" S
                > ^!Replace "^p" >> "|" S
                > ^!Replace "^p" >> "|" S
                > ^!IfError End
                > ^!Jump +1
                > ^!Goto next_record

                <SNIPALOT>

                Howdy, All -
                Just to add one more, since I didn't see any regex'es :-)

                H="nospace 2 pipe"
                :Begin1
                ^!Set %i%=1
                :Loop4
                ^!IfError End
                ^!Replace "\s*\n" >> "|" R
                ^!Inc %i%
                ^!If "^%i%" < "4" Loop4 Else done4
                :done4
                ^!Jump +1
                ^!GoTo Begin1
              • Jody
                Hi Larry, ... From what I could tell by the way Don wrote the Clip he wanted every line of the output to have four records on it. That is why we have the
                Message 7 of 15 , Sep 5, 2000
                View Source
                • 0 Attachment
                  Hi Larry,

                  >>^!Replace "^p" >> "|" S
                  >>^!Replace "^p" >> "|" S
                  >>^!Replace "^p" >> "|" S


                  >My math is probably off (I used to be a bookkeeper) but I count
                  >11 lines of code above as compared to five lines below and there
                  >are no loops in either clip.

                  From what I could tell by the way Don wrote the Clip he wanted
                  every line of the output to have four records on it. That is why
                  we have the longer Clips. My very first one which I did not post
                  was real short like your's till I studied his Clip some more and
                  had to go back to the drawing board.

                  Happy Clip'n!
                  Jody

                  http://www.sureword.com/notetab

                  Subscribe, UnSubscribe, Options
                  mailto:Ntb-Clips-Subscribe@...
                  mailto:Ntb-Clips-UnSubscribe@...
                  http://www.egroups.com/group/ntb-clips
                • Larry Thomas
                  Hi Jody, ... Ah yes :( There really is such a thing as being in to much of a hurry to get the point. Thanks for explaining. Regards, Larry
                  Message 8 of 15 , Sep 5, 2000
                  View Source
                  • 0 Attachment
                    Hi Jody,

                    At 11:42 AM 09/05/2000 -0500, you wrote:
                    >
                    >Hi Larry,
                    >
                    > From what I could tell by the way Don wrote the Clip he wanted
                    >every line of the output to have four records on it. That is why
                    >we have the longer Clips. My very first one which I did not post
                    >was real short like your's till I studied his Clip some more and
                    >had to go back to the drawing board.

                    Ah yes :( There really is such a thing as being in to much of a hurry to
                    get the point. Thanks for explaining.

                    Regards,

                    Larry
                    larryt@...
                  • Don Passenger
                    Thank you to each one of you for the help. What a helpful group! No wonder Note Tab is the #one user preferred program in its class! I learned a lot from
                    Message 9 of 15 , Sep 5, 2000
                    View Source
                    • 0 Attachment
                      Thank you to each one of you for the help.

                      What a helpful group! No wonder Note Tab is the #one user preferred program
                      in its class!

                      I learned a lot from reading through the suggestions. Finding this bit:
                      ^$StrTrim("^$GetSelection$")$
                      made the whole exercise worthwhile, without anything more! Some of my
                      actual data in fact had leading spaces too, the more I looked at it, so that
                      took care of it before I even realized I had the problem.

                      I took some version of the suggestions and I processed all 373 records I had
                      (actually 26 lines per record...though my example just had 4...by the 373
                      records) and got the correct format for output which I successfully imported
                      into Access and now have a new database. Awesome.


                      I use kclip for my help on these things. In one respect the information
                      mislead me there. I see I should have been using jump +1 to drop a line. I
                      read the help in kclip and it said: "Moves cursor to the indicated
                      position."
                      I took that to mean position (ie row and column), not line, so I tried to
                      move the cursor a different way. My way choked on blank lines. This is
                      better. When help is redone, the word position should be replaced with the
                      word line, in my humble opinion.

                      One other thing about kclip I found annoying, is when searching for a term
                      (using the locate function) it will search in a big loop starting over at
                      the beginning without announcing it is back to the start. Is there any way
                      to adjust that so it will stop at the bottom and ask before restarting? It
                      is a very nice interface otherwise.
                      It did take a while to process as I used one of the earlier suggestions, so
                      next time I will definately work on the more efficient models to get them
                      functional. All of the scrolling text looked like a bad programmers dream.
                      lol

                      ---
                      Don Passenger
                      Personal Page: http://www.iserv.net/~dpasseng
                      Court Page: http://www.iserv.net/~dpasseng/grdc
                      ----- Original Message -----
                      From: Jody <KJB1611@...>
                      To: <ntb-clips@egroups.com>
                      Sent: Tuesday, September 05, 2000 11:01 AM
                      Subject: Re: [Clip] trying to remove some spaces at the end of a line


                      >
                      > Hi Claes and Larry,
                      >
                      > >Since the discussion seems to drift towards code efficiency,
                      > >wouldn't the following be rather straightforward, eliminating at
                      > >least one loop?
                      >
                      > Your's is the shortest. ;) I still like the first one I posted
                      > though, because it does not use Keyboard; just a think with me -
                      > personal preference for the most part. I guess it sounds too
                      > much like having to take my hand off the mouse and actually use a
                      > keyboard shortcut. <g>
                      >
                      > H=Regards /Claes
                      > ^!SetScreenUpdate Off
                      > ^!TOOLBAR Select All
                      > ; compliments of Larry ;)
                      > ^!KeyBoard ALT+M A L ALT+M L T
                      > ^!Jump 1
                      > :next_record
                      > ^!Replace "^p" >> "|" S
                      > ^!Replace "^p" >> "|" S
                      > ^!Replace "^p" >> "|" S
                      > ^!IfError End
                      > ^!Jump +1
                      > ^!Goto next_record
                      >
                      > H=Jody II
                      > ^!Jump 1
                      > ^!Set %n%=1
                      > ^!Select All
                      > ^!Keyboard Alt+M L T
                      >
                      > :Start
                      > ^!Replace "^p" >> "|" S
                      > ^!IfError End
                      > ^!Inc %n%
                      > ^!If ^%n% = 4 Skip
                      > ^!Goto Start
                      >
                      > ^!Set %n%=1
                      > ^!Jump +1
                      > ^!Goto Start
                      >
                      > H=Jody I
                      > ^!Jump 1
                      > ^!Set %n%=1
                      >
                      > :Start
                      > ^!Select Eol
                      > ^$StrTrim("^$GetSelection$")$
                      > ^!Replace "^p" >> "|" S
                      > ^!IfError End
                      > ^!Inc %n%
                      > ^!If ^%n% = 4 Skip
                      > ^!Goto Start
                      >
                      > ^!Set %n%=1
                      > ^!Select Eol
                      > ^$StrTrim("^$GetSelection$")$
                      > ^!Jump +1
                      > ^!Goto Start
                      >
                      > Happy Clip'n!
                      > Jody
                      >
                      > http://www.sureword.com/notetab
                      >
                      > Subscribe, UnSubscribe, Options
                      > mailto:Ntb-Clips-Subscribe@...
                      > mailto:Ntb-Clips-UnSubscribe@...
                      > http://www.egroups.com/group/ntb-clips
                      >
                      >
                      >
                      >
                    • Larry Thomas
                      Hi Don, ... Well, finally it looks like my clip would have worked for you after all with a modification to loop through each of the records. If you look at
                      Message 10 of 15 , Sep 5, 2000
                      View Source
                      • 0 Attachment
                        Hi Don,

                        At 01:11 PM 09/05/2000 -0400, you wrote:
                        >
                        >Thank you to each one of you for the help.
                        >
                        >What a helpful group! No wonder Note Tab is the #one user preferred program
                        >in its class!
                        >
                        >I learned a lot from reading through the suggestions. Finding this bit:
                        >^$StrTrim("^$GetSelection$")$
                        >made the whole exercise worthwhile, without anything more! Some of my
                        >actual data in fact had leading spaces too, the more I looked at it, so that
                        >took care of it before I even realized I had the problem.
                        >
                        >I took some version of the suggestions and I processed all 373 records I had
                        >(actually 26 lines per record...though my example just had 4...by the 373
                        >records) and got the correct format for output which I successfully imported
                        >into Access and now have a new database. Awesome.

                        Well, finally it looks like my clip would have worked for you after all
                        with a modification to loop through each of the records. If you look at
                        ^!Select and try it, you will discover that you can select a group of lines
                        from the current cursor position by typing ^!Select ^%Number% with
                        ^%Number% containing the number of lines you want to select. When you use
                        my clip as a part of this to process that selection, then you would use
                        ^!Jump +1 to go to the next line and then ^!Select ^%Number% again for the
                        next record until you reached the end of the file and you would have to
                        have the loop that you had to tell the clip when the end of the file was
                        reached and to quit.

                        Regards,

                        Larry
                        larryt@...
                      • Jody
                        Hi Don ... You will need to write Grandma Kay about that. If the eMail address is not current in her Help program you should be able to get it at her site. I
                        Message 11 of 15 , Sep 7, 2000
                        View Source
                        • 0 Attachment
                          Hi Don

                          >One other thing about kclip I found annoying, is when searching
                          >for a term (using the locate function) it will search in a big
                          >loop starting over at the beginning without announcing it is back
                          >to the start. Is there any way to adjust that so it will stop at
                          >the bottom and ask before restarting? It is a very nice
                          >interface otherwise.

                          You will need to write Grandma Kay about that. If the eMail
                          address is not current in her Help program you should be able to
                          get it at her site. I don't know if she is reading the list at
                          this time. I sure do miss her input though!!!

                          Introduction to Clip Programming
                          Try: mailto:kayr@... and http://sure2.com/notetab.shtml

                          Happy Clip'n!
                          Jody

                          http://www.sureword.com/notetab

                          Subscribe, UnSubscribe, Options
                          mailto:Ntb-Clips-Subscribe@...
                          mailto:Ntb-Clips-UnSubscribe@...
                          http://www.egroups.com/group/ntb-clips
                        Your message has been successfully submitted and would be delivered to recipients shortly.