c# code to reverse string e.g: " This is my book" should be reversed as "book my is this".
C# code to reverse string
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
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 attend5days leftRegister
KalaiRank #8,005 · 230 reputationPosted Jun 26, 2014, 3:06 AM EDT
Refer this http://www.dotnetperls.com/reverse-words
Princy GuptaRank #1,602 · 982 reputationPosted Jun 26, 2014, 3:11 AM EDT
public static string ReverseWords(string sentence)
{
string[] words = sentence.Split(' ');
Array.Reverse(words);
return string.Join(" ", words);
}
Veekkas Yerhpude33 reputationPosted Jun 26, 2014, 3:16 AM EDT
Veekkas Yerhpude33 reputationPosted Jun 26, 2014, 3:17 AM EDT