1οΈβ£ μ μ
Sequence
νμ
μ μ¬μ©νλ κ°μ²΄λ₯Ό μ΄μ΄ λΆμ΄λ λ©μλ
func joined() -> FlattenSequence<Self>
func joined<Separator>(separator: Separator) -> JoinedSequence<Self> where Separator : Sequence, Separator.Element == Self.Element.Element
2οΈβ£ μ€λͺ
let arr = ["hello", "world", "swift"]
let joinedString = arr.joined(separator: " ")
print(joinedString)
joined
λ©μλλ λ°ν νμ
μ΄ String
μ΄ μλλΌ String.Element
μ΄κΈ° λλ¬Έμ, μ΄ λ©μλλ₯Ό νΈμΆν μ΄νμλ joined
κ° λ°νν κ²°κ³Όλ¬Όμ λ€μ String
μΌλ‘ νλ³ν ν΄μ£Όμ΄μΌ ν¨
let arr = ["hello", "world", "swift"]
let joinedString = arr.joined(separator: " ")
let finalString = String(joinedString)
print(finalString)
μΆμ²π
πApple Docs: joined()
πApple Docs: joined(separator:)