I'm using this little piece of code to go through some inputted text and extracting sentences separated by the markers:
NSCharacterSet *punctuation =
[NSCharacterSet characterSetWithCharactersInString:@".!?\n"];
NSArray *parts = [data componentsSeparatedByCharactersInSet:punctuation];
The issue is that the resulting array is stripped from the punctuation. How do i go about storing the data with the appropriate punctuation? If possible, i'd like keep sentences marked with a newline (\n) as they are.
For example, if I enter this:
This is a sentence. It is marked by a period. This sentence is not marked by one How do you do? I'm doing very good!
I'd like to get something like this:
This is a sentence.
It is marked by a period.
This sentence is not marked by one
How do you do?
I'm doing very good!