[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Help: Matching last character of a string!

Uwe Lammers

8/4/2007 12:46:00 PM

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
--
Posted via http://www.ruby-....

1 Answer

Hermann Martinelli

8/4/2007 3:25:00 PM

0

Uwe Lammers wrote:
> 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