Created
October 10, 2012 21:03
-
-
Save flores/3868385 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
tonina:~# # lameness above (js) | |
tonina:~# node nodetest | |
\"I\"+\"want\"+\"easy escaping\" | |
tonina:~# #Ruby | |
tonina:~# irb | |
irb(main):001:0> %Q{"I"+"want"+"easy escaping"} | |
=> "\"I\"+\"want\"+\"easy escaping\"" |
This file contains hidden or 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
function Q(string){ | |
replaced=string.replace(/"/g,'\\"'); | |
return replaced; | |
} | |
console.log(Q('"I"+"want"+"easy escaping"')); |
This file contains hidden or 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
function Q(string){ | |
replaced=string.replace(/"/g,'\\"'); | |
return replaced; | |
} | |
console.log(Q('"I"+"want"+"easy escaping"')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment