I have the following string and I want to detect the newline character there. But the Ruby's string method include?
fails to detect it.
I am running Ruby 1.9.2p290
. Where am I going wrong there?
"/'ædres/ \nYour ".include?('\n')
=> false
\n
needs to be in a double quoted string, otherwise there'll be no escaping.
>> "\n".include? '\n'
=> false
>> "\n".include? "\n"
=> true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With