string array conversion

  • Thread starter Thread starter Jimmy
  • Start date Start date
J

Jimmy

Hi

I want to write a program to reverse a string.For example :string
stobereversed ="hello how are you"
becomes :"you are how hello". What is the fastest and most elegant code for
this?

thanks

Jim
 
Hi

I want to write a program to reverse a string.For example :string
stobereversed ="hello how are you"
becomes :"you are how hello". What is the fastest and most elegant code for
this?

I don't know if it's the fastest and most elegant, but this will work:

string str = "hello how are you";
string [] ar = str.Split(' ');
Array.Reverse(ar);
string strR = string.Join(" ", ar);
 
Back
Top