这样写起来好不优雅😅
let startIndex = string.index(string.startIndex, offsetBy: range.location)
let endIndex = string.index(startIndex, offsetBy: range.length)
let word = String(string[startIndex..<endIndex])
感觉没有啊,其实就是啰嗦点,谈不上不优雅吧