I have an array like so: ["data","data2"]
What would be the most Ruby-like way to convert this into a string with brackets included: "['data','data2']"
Thanks
我不能说这是多么“ruby-ish”,但这是我通常做的事情:
puts "['" + array_of_strings.join("','") + "']"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.