------art_48214_33507980.1186506766892
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 8/7/07, ronald braswell <rpbraswell / gmail.com> wrote:
>
>
>
> On 8/7/07, Gani Ruthellen <ganietse / gmail.com> wrote:
> >
> > Given:
> > lines  ile.readlines("\x15")  # don't ask :)
> >   lines.each do |y|
> >     y.chomp!("\x15")
> >     y.sub!(/^\n/,"") #kill off the extra line feeds
> >     if y /^\*\*\*/ then
> >       y  <someTag>" + y + "</someTag>"
> >     ...
> > [ assume ends]
> > puts lines
> >
> > my output for the affected elements is:
> > <someTag>
> > value of y</someTag>
> >
> > How can I get the results to be
> > <someTag>value of y</someTag>
> >
> > I've tried changing y to y.to_s; I still get the new line.
> >
> > I'm sure this is obvious if you know what you're doing, but I'm stumped.
> >
> > Can somebody give me a clue?
> >
> > TIA if you take a moment to point me in the right direction.
> > Gani
> > --
> > Posted via http://www.ruby-forum.com/.
>
>
> Hi Gani,
>
> try
>   y.gsub!(/^\n/,"") #kill off the extra line feeds
> instead of
>   y.sub!(/^\n/,"") #kill off the extra line feeds
>
> Ron
>
>
Oops. That would not be any different because of the ^anchor.
y.sub!(/^\n+/,"") might do the trick.

Ron

------art_48214_33507980.1186506766892--