iOS Swift 4 Coding

How to join an array to a string in Swift 4?

2 views August 29, 2018 August 30, 2018 bicobro 0

To join the items of a string array together with Swift 4, you simply call the “joined” member of the String array object.

let myArray = ["A", "B", "C"]
let myString = myArray.joined(separator: "-")
// myString = "A-B-C"

 

Was this helpful?