[Solved] which sentence is largest and how many number contains [closed]


You were close to getting there. This is easiest if you use the System.Linq namespace:

string[] txt = i.Split(new char[] { '.', '?', '!', ',' }); //this part you had correct
var stringsOrderedByLargest = txt.OrderByDescending(s => s.length);

stringsorderedByLargest will now contain be sorted from longest to shortest. If you want to count how many words a string has, just do another split, but this time on ‘ ‘ and look at the Count property of the resulting collection.

0

solved which sentence is largest and how many number contains [closed]