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

Capitalize only the first letter of a phrase

Expand Messages
  • c.brito78
    Friends, I have a .txt file, more or less 200 lines, in some of these lines the first letter of the line are capitalized and in others no. All lines ending
    Message 1 of 9 , Jul 26, 2010
    • 0 Attachment
      Friends,

      I have a .txt file, more or less 200 lines, in some of these lines the first letter of the line are capitalized and in others no. All lines ending with a point (.) and NewLine (^P).

      This file like this:

      this is a line.
      Other line, capitalized in the first letter.
      other line, no capitalized.
      another line, no capitalized.

      Ok.

      How to capitalize only the first letter of all these lines?

      If is possible to do that without using a loop?

      Thanks!
    • John Shotsky
      Here is one way with a loop. I don t know how to do it without a loop. ;Upper case 1st line character ^!Jump Doc_Start ... ^!Find ^([a-z]) IRS ^!IfError
      Message 2 of 9 , Jul 26, 2010
      • 0 Attachment
        Here is one way with a loop. I don't know how to do it without a loop.

        ;Upper case 1st line character
        ^!Jump Doc_Start
        :Loop
        ^!Find "^([a-z])" IRS
        ^!IfError LoopDone
        ^!InsertText ^$StrUpper("^$GetSelection$")$
        ^!If ^$GetRow$=^$GetTextLineCount$ LoopDone
        ^!Goto Loop
        :LoopDone

        If you are going to have accented characters as first characters, you'll have to change a-z to
        [:lower:].
        Regards,
        John

        From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of c.brito78
        Sent: Monday, July 26, 2010 15:51
        To: ntb-clips@yahoogroups.com
        Subject: [Clip] Capitalize only the first letter of a phrase


        Friends,

        I have a .txt file, more or less 200 lines, in some of these lines the first letter of the line are
        capitalized and in others no. All lines ending with a point (.) and NewLine (^P).

        This file like this:

        this is a line.
        Other line, capitalized in the first letter.
        other line, no capitalized.
        another line, no capitalized.

        Ok.

        How to capitalize only the first letter of all these lines?

        If is possible to do that without using a loop?

        Thanks!



        [Non-text portions of this message have been removed]
      • c.brito78
        Thanks very much, John!
        Message 3 of 9 , Jul 26, 2010
        • 0 Attachment
          Thanks very much, John!

          ======================

          --- In ntb-clips@yahoogroups.com, "John Shotsky" <jshotsky@...> wrote:
          >
          > Here is one way with a loop. I don't know how to do it without a loop.
          >
          > ;Upper case 1st line character
          > ^!Jump Doc_Start
          > :Loop
          > ^!Find "^([a-z])" IRS
          > ^!IfError LoopDone
          > ^!InsertText ^$StrUpper("^$GetSelection$")$
          > ^!If ^$GetRow$=^$GetTextLineCount$ LoopDone
          > ^!Goto Loop
          > :LoopDone
          >
          > If you are going to have accented characters as first characters, you'll have to change a-z to
          > [:lower:].
          > Regards,
          > John
          >
          > From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of c.brito78
          > Sent: Monday, July 26, 2010 15:51
          > To: ntb-clips@yahoogroups.com
          > Subject: [Clip] Capitalize only the first letter of a phrase
          >
          >
          > Friends,
          >
          > I have a .txt file, more or less 200 lines, in some of these lines the first letter of the line are
          > capitalized and in others no. All lines ending with a point (.) and NewLine (^P).
          >
          > This file like this:
          >
          > this is a line.
          > Other line, capitalized in the first letter.
          > other line, no capitalized.
          > another line, no capitalized.
          >
          > Ok.
          >
          > How to capitalize only the first letter of all these lines?
          >
          > If is possible to do that without using a loop?
          >
          > Thanks!
          >
          >
          >
          > [Non-text portions of this message have been removed]
          >
        • Alec Burgess
          c.brito: The other way to do it is to have 26 lines (more if you have to meet John s caution about accented characters) of the form: ^!replace ^a A
          Message 4 of 9 , Jul 26, 2010
          • 0 Attachment
            c.brito:
            The other way to do it is to have 26 lines (more if you have to meet
            John's caution about accented characters) of the form:

            ^!replace "^a" >> "A" rwais
            ^!replace "^b" >> "B" rwais
            ; following same pattern thru ...
            ^!replace "^z" >> "Z" rwais

            --
            Regards ... Alec (buralex@gmail& WinLiveMess - alec.m.burgess@skype)



            On 2010-07-26 19:43, c.brito78 wrote:
            >
            > Thanks very much, John!
            >
            > ======================
            >
            > --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>,
            > "John Shotsky" <jshotsky@...> wrote:
            > >
            > > Here is one way with a loop. I don't know how to do it without a loop.
            > >
            > > ;Upper case 1st line character
            > > ^!Jump Doc_Start
            > > :Loop
            > > ^!Find "^([a-z])" IRS
            > > ^!IfError LoopDone
            > > ^!InsertText ^$StrUpper("^$GetSelection$")$
            > > ^!If ^$GetRow$=^$GetTextLineCount$ LoopDone
            > > ^!Goto Loop
            > > :LoopDone
            > >
            > > If you are going to have accented characters as first characters,
            > you'll have to change a-z to
            > > [:lower:].
            > > Regards,
            > > John
            > >
            > > From: ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>
            > [mailto:ntb-clips@yahoogroups.com
            > <mailto:ntb-clips%40yahoogroups.com>] On Behalf Of c.brito78
            > > Sent: Monday, July 26, 2010 15:51
            > > To: ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>
            > > Subject: [Clip] Capitalize only the first letter of a phrase
            > >
            > >
            > > Friends,
            > >
            > > I have a .txt file, more or less 200 lines, in some of these lines
            > the first letter of the line are
            > > capitalized and in others no. All lines ending with a point (.) and
            > NewLine (^P).
            > >
            > > This file like this:
            > >
            > > this is a line.
            > > Other line, capitalized in the first letter.
            > > other line, no capitalized.
            > > another line, no capitalized.
            > >
            > > Ok.
            > >
            > > How to capitalize only the first letter of all these lines?
            > >
            > > If is possible to do that without using a loop?
            > >
            > > Thanks!
            >
            >



            [Non-text portions of this message have been removed]
          • loro
            ... I saw you got your clip. Just wanted to mention there is a menu command for this already. Modify | Text Case | Sentence . Lotta
            Message 5 of 9 , Jul 26, 2010
            • 0 Attachment
              c.brito78 wrote:
              >I have a .txt file, more or less 200 lines, in some of these lines
              >the first letter of the line are capitalized and in others no. All
              >lines ending with a point (.) and NewLine (^P).


              I saw you got your clip. Just wanted to mention there is a menu
              command for this already. Modify | Text Case | Sentence .

              Lotta
            • diodeom
              ... Yes, though it s a bit clunky: ^!SetWordWrap 0 ^!Jump 1 ;Adjust/remove to fit your system: ^!KeyboardDelay 50 ^!Keyboard Alt+M B U 1 Alt+W 1 Alt+R
              Message 6 of 9 , Jul 26, 2010
              • 0 Attachment
                "c.brito78" <c.brito78@...> wrote:
                >
                > (...)
                > How to capitalize only the first letter of all these lines?
                >
                > If is possible to do that without using a loop?
                >

                Yes, though it's a bit clunky:

                ^!SetWordWrap 0
                ^!Jump 1
                ;Adjust/remove to fit your system:
                ^!KeyboardDelay 50
                ^!Keyboard Alt+M B U 1 Alt+W 1 Alt+R ^$GetLineCount$ Enter
                ^!Jump 1
                ^!SetClipboard ^$StrUpper(^$GetClipboard$)$
                ^!Keyboard Alt+M B P
                ^!Select 0
              • diodeom
                ... If(!) it s of any importance in a given scenario, Shift+Ctrl+U refuses to preserve capital letters that may be present further in a line.
                Message 7 of 9 , Jul 26, 2010
                • 0 Attachment
                  loro <tabbie@...> wrote:
                  >
                  > I saw you got your clip. Just wanted to mention there is a menu
                  > command for this already. Modify | Text Case | Sentence .
                  >
                  > Lotta
                  >

                  If(!) it's of any importance in a given scenario, Shift+Ctrl+U refuses to preserve capital letters that may be present further in a line.
                • John Shotsky
                  This would work great if there are no other capitalized words in the lines. It could even be set up as a clip to select all, then sentence case all, if it has
                  Message 8 of 9 , Jul 26, 2010
                  • 0 Attachment
                    This would work great if there are no other capitalized words in the lines. It could even be set up
                    as a clip to select all, then sentence case all, if it has to be done repeatedly.

                    Regards,
                    John

                    From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of loro
                    Sent: Monday, July 26, 2010 18:08
                    To: ntb-clips@yahoogroups.com
                    Subject: Re: [Clip] Capitalize only the first letter of a phrase


                    c.brito78 wrote:
                    >I have a .txt file, more or less 200 lines, in some of these lines
                    >the first letter of the line are capitalized and in others no. All
                    >lines ending with a point (.) and NewLine (^P).

                    I saw you got your clip. Just wanted to mention there is a menu
                    command for this already. Modify | Text Case | Sentence .

                    Lotta



                    [Non-text portions of this message have been removed]
                  • loro
                    ... Judging from the sample lines, there aren t. But I guess in reality there may be... Lotta
                    Message 9 of 9 , Jul 26, 2010
                    • 0 Attachment
                      John Shotsky wrote:
                      >This would work great if there are no other capitalized words in the lines.

                      Judging from the sample lines, there aren't. But I guess in reality
                      there may be...

                      Lotta
                    Your message has been successfully submitted and would be delivered to recipients shortly.