Hi all,
array=[“api”,“api2”]
array.join(‘,’)
i get ''api,api2"
wat i want is ‘api’,‘api2’
how can i get it
Hi all,
array=[“api”,“api2”]
array.join(‘,’)
i get ''api,api2"
wat i want is ‘api’,‘api2’
how can i get it
a little hackish but
“‘#{array.join(’','‘)}’”
or
array.join(‘,’).inspect.gsub(//, ‘’)
Can’t try it out because I can’t reach my development machine and I did not need such behavior but intuitively I would try
“'” + array.join(“‘,’”) + “'”
it is " followed by ’ for opening and vice versa for closing. The ’ in the resulting string at the beginning and the end had to be added manually by adding “'”.
HTH Norbert
Top posted from android
array.map{|e| "'#{e}'"}.join(',')
Thanks lot,its works well