How to split a string into sentences cocoa
cocoa, iphone, nsstring, objective-c, string
Solution
Use CFStringTokenizer. You'll want to create the tokenizer with the `kCFStringTokenizerUnitSentence` option.
Problem
I have an `NSString` with a number of sentences, and I'd like to split it into an `NSArray` of sentences. Has anybody solved this problem before? I found `enumerateSubstringsInRange:options:usingBlock:` which is able to do it, but it looks like it isn't available on the iPhone (Snow Leopard only). I thought about splitting the string based on periods, but that doesn't seem very robust. So far my best option seems to be to use RegexKitLite to regex it into an array of sentences. Solutions?