为什么某些 Swift 标准库函数在 playground 中无法识别?
Why are some Swift standard library functions not recognized in playground?
有一个叫做countElements()
的函数,它应该是Swift中的标准库函数(该函数出现在当前Swift 2.0的第160页'The Swift Programming Language').
的更新版本
那么,下面的代码难道不能正常工作吗?
在 Swift 2.0 中,不再有 countElements(...)
方法。请改用 stringA.characters.count
。 characters
returns 字符串中的字符数组,count
returns 字符数组中的项目数。
有一个叫做countElements()
的函数,它应该是Swift中的标准库函数(该函数出现在当前Swift 2.0的第160页'The Swift Programming Language').
那么,下面的代码难道不能正常工作吗?
在 Swift 2.0 中,不再有 countElements(...)
方法。请改用 stringA.characters.count
。 characters
returns 字符串中的字符数组,count
returns 字符数组中的项目数。