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

[Clip] Replace NewLines

Expand Messages
  • Jon Tams
    Hi all, I know this should be simple, but I am still a rookie! I am trying to write a clip that will replace all -newlines- in selected text with something
    Message 1 of 3 , Apr 1, 1999
    • 0 Attachment
      Hi all,

      I know this should be simple, but I am still a rookie!
      I am trying to write a clip that will replace all -newlines- in selected
      text with something else (such as a comma).

      Example:
      a
      b
      c
      d
      would turn into:
      a,b,c,d

      I have been playing with ^$StrReplace("^%NL%";",";"^&";False;False)$
      It doesn't seem to recognize the newlines. Also during testing I found
      that
      ^$StrReplace("a";"b";"^&";False;False)$ will work fine on a single line,
      but if I select multiple lines I always get a syntax error. I assume it
      has something to do with the newline characters.

      Any ideas??

      Jon


      ------------------------------------------------------------------------
      eGroup home: http://www.eGroups.com/list/ntb-clips
      Free Web-based e-mail groups by eGroups.com
    • Jody
      Hi Jon, ... This works fine for me with the text given above: ^!Select All ^$StrReplace( ^%nl% ; , ; ^$GetSelection$ ;False;False)$ You can also use: ^!Replace
      Message 2 of 3 , Apr 1, 1999
      • 0 Attachment
        Hi Jon,

        >a
        >b
        >c
        >d
        >would turn into:
        >a,b,c,d
        >
        >I have been playing with ^$StrReplace("^%NL%";",";"^&";False;False)$
        >It doesn't seem to recognize the newlines.

        This works fine for me with the text given above:

        ^!Select All
        ^$StrReplace("^%nl%";",";"^$GetSelection$";False;False)$

        You can also use:

        ^!Replace "^p" >> "," WAS


        >^$StrReplace("a";"b";"^&";False;False)$ will work fine on a single line,
        >but if I select multiple lines I always get a syntax error.

        Use it without the ^& changing it for ^$GetSelection$ instead.

        ^$StrReplace("^%NL%";",";"^&";False;False)$
        ^$StrReplace("^%nl%";",";"^$GetSelection$";False;False)$

        Happy NoteTabbin',
        Jody Adair

        The NoteTabbers Assistant Page
        http://www.sureword.com/notetab/
        NoteTab Home Page - Go Pro......
        http://www.notetab.com

        ------------------------------------------------------------------------
        eGroup home: http://www.eGroups.com/list/ntb-clips
        Free Web-based e-mail groups by eGroups.com
      • Dennis Partridge
        ... Hi Jon, I do this quite often. Here s the code I use: ^!Select All ^$StrReplace( ^%NL% ; ^%space% ; ^$GetText$ ;True;True)$ Good luck, Dennis Dennis N.
        Message 3 of 3 , Apr 2, 1999
        • 0 Attachment
          At 07:38 AM 4/1/99 -0800, you wrote:
          >Hi all,
          >
          >I know this should be simple, but I am still a rookie!
          >I am trying to write a clip that will replace all -newlines- in selected
          >text with something else (such as a comma).
          >
          >Example:
          >a
          >b
          >c
          >d
          >would turn into:
          >a,b,c,d
          >

          Hi Jon,

          I do this quite often. Here's the code I use:

          ^!Select All
          ^$StrReplace("^%NL%";"^%space%";"^$GetText$";True;True)$

          Good luck,

          Dennis

          Dennis N. Partridge
          partridge@...

          The SurnameWeb
          http://www.surnameweb.org/
          Co-Founder and Team Leader


          The Partridge Nest
          http://www.surnameweb.org/centers/p/partridge/
          Webmaster

          ------------------------------------------------------------------------
          eGroup home: http://www.eGroups.com/list/ntb-clips
          Free Web-based e-mail groups by eGroups.com
        Your message has been successfully submitted and would be delivered to recipients shortly.