Swift3:
let stings= "a, b,c"
var i = stings.characters.startIndex
swift4中直接操作字符串父泳,無(wú)須通過(guò)characters:
let stings= "a, b,c"
var i = strings.startIndex
swift4中字符串也是一個(gè)集合了玻侥,所以可以有filter,map等集合的特性
swift4中采用了三引號(hào)來(lái)代表?yè)Q行,首尾的三行號(hào)必須單獨(dú)一行
無(wú)須通過(guò)\n來(lái)?yè)Q行咯
let strings = '''
my name is hellos,
nice to meet you
'''
// my name is hellos,
nice to meet you
swift3中取字符串的某位
strings[i ..< strings.endIndex]
swift4中利用...來(lái)匹配
strings[i...]