Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我怎样才能转换这个数组
['h', 'b']
进入这个数组
[['Home', 'h'], ['Business', 'b']]
在红宝石?
我需要这个来填充一个选择框,其中包含保存在数据库中的值。
谢谢你的帮助...
你的问题不清楚。假设你有两个数组。你可以像下面这样
x=[1,2] => [1, 2] y=["a","b"] => ["a", "b"] x.zip y => [[1, "a"], [2, "b"]]