I'm trying to implement a word count function for my app that uses UITextView.

There's a space between two words in English, so it's really easy to count the number of words in an English sentence. The problem occurs with Chinese and Japanese word counting because usually, there's no any space in the entire sentence.

I checked with three different text editors in iPad that have a word count feature and compare them with MS Words.

For example, here's a series of Japanese characters meaning the world's idea: 世界(the world)の('s)アイデア(idea)

世界のアイデア

1) Pages for iPad and MS Words count each character as one word, so it contains 7 words.

2) iPad text editor P*** counts the entire as one word --> They just used space to separate words.

3) iPad text editor i*** counts them as three words --> I believe they used CFStringTokenizer with kCFStringTokenizerUnitWord because I could get the same result)

I've researched on the Internet, and Pages and MS Words' word counting seems to be correct because each Chinese character has a meaning.

I couldn't find any class that counts the words like Pages or MS Words, and it would be very hard to implement it from scratch because besides Japanese and Chinese, iPad supports a lot of different foreign languages.

I think CFStringTokenizer with kCFStringTokenizerUnitWord is the best option though.

Is there a way to count words in NSString like Pages and MSWords?

Thank you

Edit
Report