陣列轉字串 | Array to String | List to String
使用 description 轉換成 string

String List / Int List

let stringList = ["1","2","3","4","5","6","7"]
let intList = [8,9,10,11,12,13,14]

description 轉字串

let stringListString = stringList.description
let intListString = intList.description

打印

stringList

"[\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"]"

intList

"[8, 9, 10, 11, 12, 13, 14]"
Swift更多文章

[教學] Swift 找字串 文字找字串


Swift字串拼接 文字拼接
Swift 字串擷取 文字擷取
Swift – 陣列轉字串 | Array to String | List to String | description
Swift Date 現在星期幾 這個月有幾天
Swift – 正規表達式 (電話/身分證/email)


Categorized in: