# (this give me list eg :,s,m ... list = list + "," + name
我想使用拆分,然后加入…尝试使用下面…我不知道我在做什么
list = list.split(',') + name + collect{|c| c.name}.to_sentence list = list.split(',') + name + collect{|c| c.name}.Join(",")
有任何想法吗??
解决方法
我不明白你的问题,但如果你想将字符串转换为数组
>> "a string".split("") => ["a"," ","s","t","r","i","n","g"]