如何在Swift中合并两个数组
我有两个数组。
let A = ["91","91","49"]let B = ["9989898909","9089890890","9098979896"]
我需要合并这些数组,并在下拉列表中显示为
["91 9989898909","91 9089890890","49 9098979896"]
我怎么能使用swift.im新手来快速获得此结果,有人可以帮忙吗?
回答:
压缩数组并连接结果:
let A=["91","91","49"]let B=["9989898909","9089890890","9098979896"]
let zipped = zip(A, B)
let result = zipped.map { $0.0 + " " + $0.1 }
以上是 如何在Swift中合并两个数组 的全部内容, 来源链接: utcz.com/qa/433515.html