String to String?

Really basic question.

How can I convert "this" to 'this'

convert from a double quotes string to a single quotes string.

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

joshmckin@gmail.com 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\'')

u can try this

@re = “this”.gsub(“this”,"‘this’")
puts @re
Thanks
seenu

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

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.