不得不说,swift取字符做的真繁琐
大致步骤如下:
let testStr = "test str"
let position = testStr.index(testStr.startIndex, offsetBy: 1) //获取String.index
let firstChar = testStr[position]
print(firstChar)
这API真心难用
不得不说,swift取字符做的真繁琐
大致步骤如下:
let testStr = "test str"
let position = testStr.index(testStr.startIndex, offsetBy: 1) //获取String.index
let firstChar = testStr[position]
print(firstChar)
这API真心难用