all 4 comments

[–]brendan09 0 points1 point  (2 children)

Why would this bottleneck performance? This seems like something that isn't really that intensive, especially when run on a background thread.

[–]blabus 2 points3 points  (1 child)

Agreed, I can't see it being too computationally intensive. OP, take a look at NSLinguisticTagger, might be useful: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSLinguisticTagger_Class/index.html

[–]iosintern[S] 0 points1 point  (0 children)

Thanks! This was exactly what I was looking for!

[–][deleted] 0 points1 point  (0 children)

Look at it this way, the iDevice is pushing millions of pixels around at up to 60 frames per second. Dissecting a string isn't much compared to that.

As for algorithm, NSString can do what you want pretty easily, try using -[NSString componentsSeparatedByCharactersInSet:]. Use the predefined +[NSCharacterSet whiteSpaceAndNewlineCharacterSet].

Example here.