How to Join an Array of Strings
포스트
취소

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"
이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.