My Question in C#.Net is like this
string str= "Hello World Welcome";
How to get the Output: "WelCome World Hello".
Please Help me
Regards
Hari
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Nov 28, 2012, 4:48 AM EST
I've assumed that 'WelCome' is a typo and you meant 'Welcome'.
Vishnujeet KumarRank #1,019 · 1.9K reputationPosted Nov 28, 2012, 5:08 AM EST
class HelloWorld
{
string value = "Hello World Welcome";
string reversestring = string.Empty;
char charSplit = ' ';
string[] Hellowords = value.Split(new char[] { charSplit }, StringSplitOptions.RemoveEmptyEntries);
foreach (string word in Hellowords)
{
reversestring = word + charSplit + reversestring;
}
Console.WriteLine(reversestring);
Console.ReadKey();
}