1.截取某字符串的前10個字符串:json
let sub1 = str.prefix(10) app
截取某字符串的後10個字符串code
let str1 = str.suffix(10)字符串
也能夠換種寫法get
let index2 = str.index(str.endIndex, offsetBy: -10)io
let sub4 = str[index2..<str.endIndex]im
截取某字符串的第3個字符到第6個字符範圍的字符串developer
let index3 = str.index(str.startIndex, offsetBy: 3)img
let index4 = str.index(str.startIndex, offsetBy: 6)apple
let sub4 = str[index3..<index4]
2. JSONDecoder實現轉Model:
https://developer.apple.com/documentation/foundation/jsondecoder
https://www.jianshu.com/p/ca1b9094d0e9
3.Swift經常使用基本第三方: