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

Deleting control line feed in string

Expand Messages
  • Mueller Stefan
    Hello, quite simple question: How can I delete a control line feed in a string I tried: Let value = substitute(string, n , , g ) But doesn t work. In vim7,
    Message 1 of 3 , Jan 30, 2007
    • 0 Attachment
      Hello,

      quite simple question:
      How can I delete a control line feed in a string
      I tried:
      Let value = substitute(string,"\\n","","g")
      But doesn't work.

      In vim7, I used
      Let list = split(string)
      Let Value = list[0]
      But this doesn't work on vim6.3 on older machine, where we have
      installed that version.

      Thank you for your help

      Best Regards
      Stefan Mueller
    • Jean-Rene David
      ... Should do what you want. Insert range as appropriate. Or ... Discusses this specific case. HTH, -- JR
      Message 2 of 3 , Jan 30, 2007
      • 0 Attachment
        * Mueller Stefan [2007.01.30 07:56]:
        > How can I delete a control line feed in a string

        :s/\\n//

        Should do what you want. Insert range as
        appropriate.

        Or

        :let value = substitute(string, "\\\\n","","g")

        :h substitute()

        Discusses this specific case.

        HTH,

        --
        JR
      • A.J.Mechelynck
        ... Jean-René, I think you and I don t understand Stefan s question the same way, so let s ask: Stefan: Does your string contain backslash-n (two characters),
        Message 3 of 3 , Jan 30, 2007
        • 0 Attachment
          Jean-Rene David wrote:
          > * Mueller Stefan [2007.01.30 07:56]:
          >> How can I delete a control line feed in a string
          >
          > :s/\\n//
          >
          > Should do what you want. Insert range as
          > appropriate.
          >
          > Or
          >
          > :let value = substitute(string, "\\\\n","","g")
          >
          > :h substitute()
          >
          > Discusses this specific case.
          >
          > HTH,
          >

          Jean-René, I think you and I don't understand Stefan's question the same way,
          so let's ask:

          Stefan: Does your string contain backslash-n (two characters), in which case
          Jean-René's solution should work, or does it contain ^J (0x0A aka linefeed,
          one control character) in which case we should try "\n" instead, and try to
          find something else if it doesn't work?


          Best regards,
          Tony.
        Your message has been successfully submitted and would be delivered to recipients shortly.