Help: Matching last character of a string!

U

Uwe Lammers

Hi,

I am trying to replace the last character of a string with
another character:

x = "{Hello {hello}}"
x.sub!(/\}$/, "]")
puts x

With Ruby 1.8.5 (on Windows) this gives (as expected)
{Hello {hello}]

With Ruby 1.8.1 (on Linux) I get (surprisingly)
{Hello {hello}}

Who knows what is going on? Can't believe a fundamental bug like
this was still in 1.8.1 ...

Cheers
Uwe
 
H

Hermann Martinelli

Uwe said:
Who knows what is going on? Can't believe a fundamental bug like
this was still in 1.8.1 ...

Hi Uwe,

No idea what/why, but at least I can tell you
that it works as expected on 1.8.4 under Linux.

HM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top