On 23 March 2012 10:36, Aaron Schmitz <a.schmitz...@googlemail.com> wrote:
> hi,
>
> im getting tired on this one.
> i want to replace all forwardslashes with backwardslashes.
>
> irb:
> r = "C:/RAILS/"
> r.gsub("/", "\\") or r.gsub("/") {('\'} both give me:
> "C:\\RAILS\\"
>
> how can i use gsub to display only one "\"?

It's escaping it to show in the console, the string does have only one
backslash.

=> "\\".size
>> 1

;-)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to