Uday kumar das Uday kumar das - 1 month ago 13
Ruby Question

Remove double quotes from a string rails 4

I have a string like:

str= "1,2,3,4"


I want to remove double quotes from this string so that i will get the result like
1,2,3,4
.
Please help me out.

JRD JRD
Answer

If you want to alter the var in place:

str="\"1,2,3,4\""
str.gsub!('"', '')
puts str
# 1,2,3,4
Comments