ReverseWords
Reverse Words
Source
public static string ReverseWords(this string sentence)
{
var words = sentence.Split(' ');
Array.Reverse(words);
//string reversed = words.Aggregate((workingSentence, next) => next + " " + workingSentence);
return string.Join(" ", words);
}
Example
var sentence = "the quick brown fox jumps over the lazy dog";
sentence.ReverseWords();