I want to reverse the string, is there any method in .Net 2010 do that? with C#lan
forexample:
string s2= "abcdefg";
but I want that "gfedcba" is written.
Console.WriteLine(s2); // gfedcba
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Jul 25, 2011, 10:43 PM EDT
string str= "jiteendra";
char[] reverse = str.ToCharArray();
Array.Reverse(reverse );
string StringReverseOrder = new string(reverse);
i hope it help you.........
Amit ChoudharyRank #145 · 15.8K reputationPosted Jul 25, 2011, 10:47 PM EDT
Using System.Linq;
String str = "aabcadfdsf";
Console.WriteLine(str.Reverse().ToArray<Char>());
Hope this was helpful.
Thanks.
Suthish NairRank #92 · 22.8K reputationPosted Jul 26, 2011, 12:25 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jul 26, 2011, 12:09 PM EDT
However, methods like this which manipulate memory directly using pointers are best avoided in normal application code - stick to the 'safe' methods.
Suthish NairRank #92 · 22.8K reputationPosted Jul 26, 2011, 9:47 PM EDT
Vulpes,
VulpesRank #55 · 29.2K reputationPosted Jul 27, 2011, 1:32 AM EDT
Hirendra SisodiyaRank #258 · 9.8K reputationPosted Jul 27, 2011, 5:24 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jul 27, 2011, 5:49 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts