开发者

How can I output a forward slash preceded by a back slash in ruby?

Is there a way to output a for开发者_JS百科ward slash preceded by a back slash in ruby?

for example: a\/b

"a\/b" yields a\b

"a\\/b" yields a\\/b


irb(main):001:0> puts 'a\/b'
a\/b
=> nil
irb(main):002:0> puts "a\\/b"
a\/b
=> nil

I get a\/b when I output "a\\/b". The single-quotes method should work as well, however.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜