I have a string that contains the words "e.g." and "Mrs.". I need to split into two sentences using the period as a delimiter. However, if I use the period character, e and g are splitted into different index in an array instead of having an array with two sentences.
string wholeSentence = @"Each paragraph may have a number of sentences, depending on the topic. I can now write topics on sports e.g. basketball, football, baseball and submit it to Mrs. Smith.";
string[] collection = wholeSentence.Split('.');
foreach(string sentence in collection)
{
Console.WriteLine(sentence);
}
Console.ReadLine();
Output
Each paragraph may have a number of sentences, depending on the topic
I can now write topics on sports e
g
basketball, football, baseball and submit it to Mrs
Smith
May I know how can this be corrected?