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

Re: [Clip] Re: Upper & Low cases

Expand Messages
  • Axel Berger
    ... In that version I have used John s Find. I just realized, that this will not get umlauts or any other kind of accented letter. So in hindsight I ll go back
    Message 1 of 15 , Aug 12, 2009
    • 0 Attachment
      "c.brito78" wrote:
      > I will test.

      In that version I have used John's Find. I just realized, that this will
      not get umlauts or any other kind of accented letter. So in hindsight
      I'll go back and recommend my older version:

      ^!Find "(?s)\R\R(.)" RS1

      Axel
    • John Shotsky
      The clip I provided ignores blank lines. It only finds lower case letters in the first position. John From: ntb-clips@yahoogroups.com
      Message 2 of 15 , Aug 12, 2009
      • 0 Attachment
        The clip I provided ignores blank lines. It only finds lower case letters in the first position.
        John

        From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of c.brito78
        Sent: Wednesday, August 12, 2009 07:05
        To: ntb-clips@yahoogroups.com
        Subject: [Clip] Re: Upper & Low cases


        Friends Alex, John, Jeff, thanks.

        I tested the Alex suggestion. Worked fine, if I have all paragraphs like:

        paragraph 1, etc etc etc.
        paragraph 2, etc etc etc.
        paragraph 3, etc etc etc.

        But my paragraphs are separated by two carriage returns, like:

        paragraph 1, etc etc etc.

        paragraph 2, etc etc etc.

        paragraph 3, etc etc etc.

        And I do not know how to include the two carriage returns to the Alex regex.

        Thanks again

        Brito

        --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> , "John Shotsky" <jshotsky@...> wrote:
        >
        > I routinely do something similar This could be made more efficient by only working on the lower case letters: (Tested)
        >
        > ^!Jump Doc_Start
        > :Loop
        > ;^!Setdebug ON
        > ^!Find "^([a-z])" RS
        > ^!Iferror Done
        > ^!InsertText ^$StrUpper(^$StrIndex("^$GetSelection$";1)$)$
        > ^!Goto Loop
        > :Done
        >
        > John
        >
        > From: ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> [mailto:ntb-clips@yahoogroups.com
        <mailto:ntb-clips%40yahoogroups.com> ] On Behalf Of Axel Berger
        > Sent: Tuesday, August 11, 2009 06:41
        > To: ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>
        > Subject: Re: [Clip] Upper & Low cases
        >
        >
        > "c.brito78" wrote:
        > > 1. The first character of a new paragraph (if either Low or Upper case)
        >
        > That's a difficult one, as Regex does not support functions and normal
        > replace can't find arbitrary letters. I have solved this kind of problem
        > with a ^!Find followed by an ^!Insert working on the found part:
        >
        > :loop
        > ^!Find "^(.)" HRS1
        > ;^!Continue
        > ^!IfError clean
        > ^!InsertText ^$StrUpper("^$GetSelection$")$
        > ^!Goto loop
        > :clean
        >
        > This is untested, but I have used the same technique with a different
        > function.
        >
        > Axel
        >
        >
        >
        > [Non-text portions of this message have been removed]
        >



        [Non-text portions of this message have been removed]
      • John Shotsky
        You re right. Since my work deals with recipes, I encounter many such letters. Have not found a good solution other than either listing them, or including some
        Message 3 of 15 , Aug 12, 2009
        • 0 Attachment
          You're right. Since my work deals with recipes, I encounter many such letters. Have not found a good solution other than
          either listing them, or including some mini-ranges to capture them.

          However, almost never does a line start with an accented letter, and usually, upper case letters should not be accented
          anyway.

          Then, there could be a problem if a line starts with a quote, double quote or a paren and is followed by a lower case
          letter -

          In the segment below, I'd use \R+ instead of \R\R, since I don't think there is a rule that there must be a blank line
          between all other lines, and it will also miss the first row, if it is lower case, unless a leading blank line is added.
          John

          From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Axel Berger
          Sent: Wednesday, August 12, 2009 07:46
          To: ntb-clips@yahoogroups.com
          Subject: Re: [Clip] Re: Upper & Low cases


          "c.brito78" wrote:
          > I will test.

          In that version I have used John's Find. I just realized, that this will
          not get umlauts or any other kind of accented letter. So in hindsight
          I'll go back and recommend my older version:

          ^!Find "(?s)\R\R(.)" RS1

          Axel



          [Non-text portions of this message have been removed]
        • Axel Berger
          ... Sorry, but in this case I claim superior knowledge as a German: Ärger, Ångstrøm, Über (capitalized as the first word of a sentence), Ölsand ... If my
          Message 4 of 15 , Aug 12, 2009
          • 0 Attachment
            John Shotsky wrote:
            > and usually, upper case letters should not be accented anyway.

            Sorry, but in this case I claim superior knowledge as a German: Ärger,
            Ångstrøm, Über (capitalized as the first word of a sentence), Ölsand ...
            If my French were acceptable, I'm sure I'd find many more examples there
            too.

            > Then, there could be a problem if a line starts with a quote,
            > double quote or a paren and is followed by a lower case letter

            True. We don't know how paragraphs and thus presumably sentences came to
            be uncapitalized in the first place, but C. specified "first character"
            in his request.

            > In the segment below, I'd use \R+ instead of \R\R, since I don't
            > think there is a rule that there must be a blank line

            My understandig was that line feeds that are not paragraphs were the
            issue here and should not be modified. As you noted yourself "The clip I
            provided ignores blank lines."

            Axel
          • Sheri
            Just another possibility: This one loops from the top finding only lower case letters as the first character of a line (possibly preceeded by a double quote)
            Message 5 of 15 , Aug 12, 2009
            • 0 Attachment
              Just another possibility: This one loops from the top finding only lower case letters as the first character of a line (possibly preceeded by a double quote) and capitalizes them. Works for plain and accented latin characters.

              ^!Jump Doc_start
              :loop
              ^!Find "^\x22?\K\p{Ll}" RS
              ^!Iferror Out
              ^!Menu Modify/Text Case/Upper Case
              ^!Goto loop
              :Out

              Regards,
              Sheri
            • ebbtidalflats
              I d like to offer my 2 cents worth (or as Axel would say, his mustard): To change the case of EVERY first character of every line, WITHOUT LOOPING, use the
              Message 6 of 15 , Aug 15, 2009
              • 0 Attachment
                I'd like to offer my 2 cents worth (or as Axel would say, his mustard):

                To change the case of EVERY first character of every line,
                WITHOUT LOOPING, use the BLOCK mode and a helper file,
                something like (untested):

                ^!SetWordWrap OFF
                ^!SelectTo ^$GetLineCount$:2
                ^!Menu Modify/Block/Cut
                ^!Set %orig%=^$GetDocIndex$
                ^!Menu File/New
                ^!Set %helper%=^$GetDocIndex$
                ^!Menu Edit/Paste
                ^!Menu Modify/"Text case"/"Upper case"
                ^!Select All
                ^!Menu Modify Block/Copy
                ^!SetDocIndex ^%orig%
                ^!SetCursor 1:1
                ^!Menu Block/Paste
                ^!DestroyDoc ^$GetDocName(^%helper%)$

                Anybody care to time executions of the various solutions?

                Cheers,

                Eb


                --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
                >
                > John Shotsky wrote:
                > > and usually, upper case letters should not be accented anyway.
                >
                > Sorry, but in this case I claim superior knowledge as a German: Ärger,
                > Ångstrøm, Über (capitalized as the first word of a sentence), Ölsand
              Your message has been successfully submitted and would be delivered to recipients shortly.