abood net

abood net

  • NA
  • 7
  • 4.4k

Problem Reversing multiple lines from a text file in C#

May 19 2011 2:45 AM
Hello everyone..

I am trying to decode the text below by reversing it.

,sdreh ni dam og yeht taht nees eb lliw ti ;sdreh ni kniht neM"
".eno yb eno dna ,ylwols sesnes rieht revocer ylno yeht elihw
yakcaM selrahC


I used this code to do it.
           String reed = File.ReadAllText("DecodeThis.txt");
           char[] array1 = reed.ToCharArray();               
           Array.Reverse(array1);
           Console.WriteLine(array1);
           Console.ReadLine();


the output is:
"Charles Mackay
while they only recover their senses slowly, and on by one.?
?Men think in hards: it will be seen taht they go mad in herds"


I want the output to be
" Men think in hards: it will be seen taht they go mad in herds,
while they only recover their senses slowly, and on by one.
Charles Mackay"


How can i do that? please help :(

Answers (6)