hi ,
I have a string with "\". how can i gsub the string?
i tried
"\".gsub(''\'','''')
but it is giving error.
thanks in advance
JK
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On Dec 24, 11:49 am, Jayakumar Manickam <rails-mailing-l...@andreas- s.net> wrote:> hi , > > I have a string with "\". how can i gsub the string? > > i tried > > "\".gsub(''\'','''') > > but it is giving error. >Neither of those string literals because the \ escapes the close quote mark. You need to escape literal backslashes. Fred> thanks in advance > JK > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On Dec 24, 11:49�am, Jayakumar Manickam <rails-mailing-l...@andreas- > s.net> wrote: >> hi , >> >> �I have a string with "\". how can i gsub the string? >> >> i tried >> >> "\".gsub(''\'','''') >> >> but it is giving error. >> > Neither of those string literals because the \ escapes the close quote > mark. You need to escape literal backslashes. > > Fredi tried "\\".gsub(''\\'',''''). it is working fine. thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---