Swift3:
let stings= "a, b,c"
var i = stings.characters.startIndex
swift4中直接操作字符串,无须通过characters:
let stings= "a, b,c"
var i = strings.startIndex
swift4中字符串也是一个集合了,所以可以有filter,map等集合的特性
swift4中采用了三引号来代表换行,首尾的三行号必须单独一行
无须通过\n来换行咯
let strings = '''
my name is hellos,
nice to meet you
'''
// my name is hellos,
nice to meet you
swift3中取字符串的某位
strings[i ..< strings.endIndex]
swift4中利用...来匹配
strings[i...]
网友评论