Swift4 获取字符串首字符或单个字符(character)
2020-03-29 本文已影响0人
GPENGF
不得不说,swift取字符做的真繁琐
大致步骤如下:
let testStr = "test str"
let position = testStr.index(testStr.startIndex, offsetBy: 1) //获取String.index
let firstChar = testStr[position]
print(firstChar)
![](https://img.haomeiwen.com/i1339853/ac056e09562d8826.png)
这API真心难用