--90e6ba53a5dead12e7049f5d5483
Content-Type: text/plain; charset=UTF-8

7stud is right.  I missed the important word "only" in your original email.
 My original method will produce false positives if you are indeed
interested in finding strings which are only "\n".

The " method works fine.  Regexp is also possible (though probably
slower) if done as:

if str /^\n$/


On Sat, Mar 26, 2011 at 3:43 AM, 7stud -- <bbxx789_05ss / yahoo.com> wrote:

> And if you want to replace all the newlines in some text, you can use
> gsub():
>
> str ENDOFSTRING
> hello world
> goodbye
> hi again world
> ENDOFSTRING
>
>
> result  tr.gsub(/\n/, ' ')
> puts result
>
> --output:--
> hello world goodbye hi again world
>
> --
> Posted via http://www.ruby-forum.com/.
>
>

--90e6ba53a5dead12e7049f5d5483--