array = []
a = "abcd"
b = a.scan(/./)
for c in b
array.push([c])
end
以下引用大地的雨于2008-7-11 17:17:44的发言:
array = []
a = "abcd"
b = a.scan(/./)
for c in b
array.push([c])
end
类似这样?
以下引用wy29于2008-7-12 8:55:30的发言:
"hello".split(//) #=> ["h", "e", "l", "l", "o"]
来自:http://www.ruby-doc.org/core/classes/String.html#M000733
[本贴由作者于 2008-7-12 8:56:10 最后编辑]
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |