I have two arrays.
let A = ["91","91","49"]
let B = ["9989898909","9089890890","9098979896"]
I need to merge these arrays and show it in the dropdown as
["91 9989898909","91 9089890890","49 9098979896"]
How can I get this result using swift.Im newbie to swift,can anyone please help on this.
Zip the arrays and concatenate the results:
here is a snippet in Swift:
Use
zip()
to join values from both arraysA
andB
. IfA
andB
have a different number of elements, the joining would still work. thenmap
the tuples from the zipped result array to those elements with a space between them