Created
May 17, 2012 07:59
-
-
Save wnuqui/2717282 to your computer and use it in GitHub Desktop.
where ruby's str#gsub can really prove that assumptions can really go wrong (any light?)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby is 1.9.2p290 | |
"Foo\n".gsub('\n', '') # => "Foo\n" | |
"Foo\n".gsub("\n", '') # => "Foo" | |
"Foo\n".gsub("\n", '') # => "Foo" | |
"Foo\n".gsub('\n', '') # => "Foo\n" | |
'Foo\n'.gsub("\n", '') # => "Foo\\n" | |
'Foo\n'.gsub('\n', '') # => "Foo" | |
# pastie here: http://pastie.org/3924412 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment