We can achieve the string reversal in a easy way.
Let us Consider a one dimensional character array, input string and an output string variable.
string strInput = "Naveen";
string strOutput= string.Empty;
Am passing the string "Naveen" to the array in the following manner.
arrStr = strInput.ToCharArray();
then we have to put a reverse for loop like below
for(int idx=arrStr.Length-1;idx>=0; idx--)
strOutput += arrStr.Getvalue(idx);
The output will be "neevaN"
Note : If you want to reverse each word, split by space and put in another array do the same operation for each item in the array and show.
Nav234, if this helps please login to Mark As Answer. | Alert Moderator