I am a bit new to Objective C and was wondering if there is a better way to count words in a string.
ie:
NSString *str = @"this is a string";
// return should be 4 words ..
The way I now how to do it is by breaking the string into an array of words space (' ') character and count the array.
Any advise will be appreciated! Thanks!! :)
EDIT:
For those of you who came here looking for answer; I found a similar post with an excellent reply.
How to count words within a text string?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…