Objective-C: -[NSString wordCount]

后端 未结 7 1185
孤街浪徒
孤街浪徒 2020-12-05 21:39

What\'s a simple implementation of the following NSString category method that returns the number of words in self, where words are separated by an

相关标签:
7条回答
  • 2020-12-05 22:10

    Swift 3:

    let words: [Any] = (string.components(separatedBy: " "))
    let count = words.count
    
    0 讨论(0)
提交回复
热议问题