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

18997RE: [Clip] Re: Need help on breaking lines, capitalization

Expand Messages
  • John Shotsky
    Mar 9, 2009
      Thanks, Sheri!

      I actually did something similar, but felt it was inelegant so was looking for an improvement. I like some of the things you've
      done, which I will implement into mine.

      Some comments about assumptions:
      1. Not every colon is a suspect - only the ones that follow 'TestString:' need to be changed. That just changes the Find.
      2. Not every case has a comma - some have none, some have one, some have more. I used an IfError to process through them.
      3. I use [##] elsewhere in my code, so I used \[SC\] as my tag. (Sentence case). I also do \[UC\] for upper case, and delete
      those all at the end of that clip section.

      I used the toolbar Sentence Case instead of your Insert Text. I will play with that, I really prefer to use Regex rather than the
      toolbar. I do this several places elsewhere also, so I'll look to reconstructing those. I'll probably keep what I have for line
      breaking but will use your method of Capping.

      Again, thanks!

      From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Sheri
      Sent: Monday, March 09, 2009 6:12 AM
      To: ntb-clips@yahoogroups.com
      Subject: [Clip] Re: Need help on breaking lines, capitalization

      --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> , "John Shotsky" <jshotsky@...> wrote:
      > Hi all,
      > I have a coding problem that I can't quite figure out, but I suspect it is easily done.
      > In a text document of hundreds to thousands of lines, there are a few that contain strings of text that I want to break out onto
      > their own lines, and capitalize the first letter. The line always starts with a recognizable name followed by a colon.
      > Input:
      > TestString: sample string 1, sample string 2, sample string 3
      > Desired output:
      > TestString:
      > Sample string 1
      > Sample string 2
      > Sample string 3
      > I appreciate any assistance!
      > John

      You could do something like this:

      ^!Jump Doc_start
      ^!Find "^\w+: .+,.*" RS
      ^!Iferror Out
      ^!Replace "((?<=:)|,) " >> "\r\n#" RAHS
      ^!Goto Loop
      ^!Jump Doc_start
      ^!Find "^\x23." RS
      ^!Iferror Done
      ^!InsertText ^$StrUpper(^$StrIndex("^$GetSelection$";2)$)$
      ^!Goto CapLoop
      ;end of clip

      It assumes the colon is after the first word on a line, and there is at least one comma on that line. Each of the colon and the
      comma(s) need to be followed by one space. It breaks all such lines into multiple lines and marks lines that need to be capitalized
      with a #. Then it goes through and finds the first two characters on lines that begin with a "#" and inserts over the selection the
      uppercase version of the 2nd character in the selection. One command in the clip has the hex value of "#" in it (\x23) because
      otherwise NoteTab substitutes the document name for "^#" (caret pound).


      [Non-text portions of this message have been removed]
    • Show all 3 messages in this topic