Posts How to Join an Array of Strings
Post
Cancel

How to Join an Array of Strings

Using joined() method, we can merge an array of strings to a single string. We can add a separator too.

1
2
3
4
let names = ["Brian", "Nick", "John", "David"]
let list = names.joined(separator: ", ")
print(list)
// "Brian, Nick, John, David"
This post is licensed under CC BY 4.0 by the author.