Confusion with String#squeeze

Hi,

Here is one confusion with String#squeeze.

string = "adb\n\n \n\nbbb"
p string.squeeze('\n') #=> "adb\n\n \n\nbbb"

why the `\n\n` not being replaced into single `\n`?

···

--
Posted via http://www.ruby-forum.com/.

you need to understand the difference between '\n' and "\n"

···

--
Posted via http://www.ruby-forum.com/.

Hans Mackowiak wrote in post #1107021:

you need to understand the difference between '\n' and "\n"

Yes, for while I forgot the difference between '' and "". Thanks for
pointing me there.

string = "adb\n\n \n\nbbb"
p string.squeeze("\n") #=> "adb\n \nbbb"

···

--
Posted via http://www.ruby-forum.com/.