swift中substringWithRange有没有语法糖?

Crafect 发布于 2017年09月06日 | 更新于 2017年09月06日
无人欣赏。

这样写起来好不优雅😅

let startIndex = string.index(string.startIndex, offsetBy: range.location)

let endIndex = string.index(startIndex, offsetBy: range.length)

let word = String(string[startIndex..<endIndex])

共1条回复
tinyfool 回复于 2017年09月06日

感觉没有啊,其实就是啰嗦点,谈不上不优雅吧

登录 或者 注册
相关帖子