开发中有时遇到会将数组以字符串的形式存在mysql中,取出来的时候怎么再转换为数组呢?
s = '["广东","广州","黄埔"]' s.gsub(/\"/,"").gsub(/[\[\]]/,"").split(",") => ["广东", "广州", "黄埔"]
开发中有时遇到会将数组以字符串的形式存在mysql中,取出来的时候怎么再转换为数组呢?
s = '["广东","广州","黄埔"]' s.gsub(/\"/,"").gsub(/[\[\]]/,"").split(",") => ["广东", "广州", "黄埔"]
转载于:https://www.cnblogs.com/gdpdroid/p/7127690.html