Swift4.0 字符串操做

import UIKit var str = "Hello, playground" var index = str.index(of: ",") //获得逗号在字符串中的位置 //Swift 3.0 let greeting = str[str.startIndex ..< index!] //获得hello index = str.index(index!, offsetBy: 1)
相关文章
相关标签/搜索