Really basic question. How can I convert "this" to ''this'' convert from a double quotes string to a single quotes string. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Jan 12, 2010 at 11:11 PM, joshmckin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <joshmckin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Really basic question. > > How can I convert "this" to ''this'' > > convert from a double quotes string to a single quotes string. > >For what purpose? -Conrad> > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
joshmckin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Really basic question. > > How can I convert "this" to ''this'' > > convert from a double quotes string to a single quotes string. > >Try this one :- str = ''"hai"'' puts str puts str.sub(/^"(.*)"$/, ''\''\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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
u can try this @re = "this".gsub("this","''this''") puts @re Thanks seenu On Wed, Jan 13, 2010 at 12:47 PM, Conrad Taylor <conradwt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Tue, Jan 12, 2010 at 11:11 PM, joshmckin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <joshmckin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > wrote: > >> Really basic question. >> >> How can I convert "this" to ''this'' >> >> convert from a double quotes string to a single quotes string. >> >> > For what purpose? > > -Conrad > > >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> >> >> > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I could be misreading, but I thought it was a simple question of how to change double quotes to single quotes. try var = ''"this"'' var.gsub!(''"'',"''") Cheers Simon On Wed, 13 Jan 2010 16:14:47 +0800, srinivasan sakthivel <seenusss2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> u can try this > > @re = "this".gsub("this","''this''") > puts @re > Thanks > seenu > > On Wed, Jan 13, 2010 at 12:47 PM, Conrad Taylor <conradwt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > >> On Tue, Jan 12, 2010 at 11:11 PM, joshmckin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> <joshmckin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> > wrote: >> >>> Really basic question. >>> >>> How can I convert "this" to ''this'' >>> >>> convert from a double quotes string to a single quotes string. >>> >>> >> For what purpose? >> >> -Conrad >> >> >>> >>> -- >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/rubyonrails-talk?hl=en. >>> >>> >>> >>> >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >>-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
joshmckin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2010-Jan-13 15:12 UTC
Re: String to String?
Thanks guys, was having some issues creating headings based on an array of column names from the DB acquired using User.column_name where "User" is the table. Turns out my problem was unrelated in the link_to code....should have went to bed sooner. On Jan 13, 1:22 am, siddick <siddick.ma...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> joshmc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > Really basic question. > > > How can I convert "this" to ''this'' > > > convert from a double quotes string to a single quotes string. > > Try this one :- > str = ''"hai"'' > puts str > puts str.sub(/^"(.*)"$/, ''\''\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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.