For a "fun time" in Ruby, take the string "'xo" and try to put a backslash before the single quote (in a way that works for any string).
@josh_cheek `str.gsub(/\\/, "\\\\").gsub(/'/, "\\'")` ? Or am I still missing something?
-
-
@sgrif yeah, f("'xo") # => "\\'xo" -
@josh_cheek Is that from inspect, or puts? If that's the output from inspect it's correct. - 4 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.