Answer the question
In order to leave comments, you need to log in
How to add a new value to a string by pattern?
There is a line: It is
necessary to turn it into the following:
How to do this optimally?
Did it like this:
my_str = "a, b, c, d, e"
my_str = "'%a%', '%b%', '%c%', '%d%', '%e%'"
a = a
.split(', ')
.map{ |e| e = "'%"+e+"%'" }
.join(', ')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question