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

47346Re: Removing blank lines from a string

Expand Messages
  • Suresh Govindachar
    Jan 31, 2004
      "Klaus Bosau" On: Saturday, January 31, 2004 8:54 PM
      >
      >Would this solve your problem?
      >
      > substitute(@a, '^\n\|\n\s*\n\@=', '', 'g')

      [My previous solution for handling multiple blank lines at the
      beginning only handled up to two blank lines at the beginning]

      I think the following is the solution:

      substitute(@a, '^\(\s*\n\)*\|\n\s*\n\@=', '', 'g')

      I have tested it with 0 or more blank lines at the beginning,
      at the end and in between two non-trivial lines; blank lines
      with and without white space; non-trivial lines starting and
      ending with and without blank space.

      --Suresh
    • Show all 10 messages in this topic