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?

you need to understand the difference between ‘\n’ and “\n”

Hans M. 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”