Reverse words in a string: Difference between revisions
Content deleted Content added
Simplified C# |
|||
Line 720:
public class ReverseWordsInString
{
public static void Main(string[] args)
{
string
"desire of tasted I've what From ",▼
"Frost Robert -----------------------" };▼
foreach(string line in lines) ▼
string[] words = line.Split(' ');▼
Array.Reverse(words);▼
fire. favor who those
Console.WriteLine();▼
//Splits on any whitespace, not just spaces
▲ Array.Reverse(words);
}
}
|