I need to reverse String of Particular words with in that

Posted by Ras90it under C# on 6/18/2012 | Points: 10 | Views : 794 | Status : [Member] | Replies : 2
I need to reverse String of Particular words with in that

Input : This Is Very Nice Place

Output : sihT sI yreV eciN ecalP

by

Raseeth.A



Responses

Posted by: jossitec-15901 on: 6/18/2012 [Member] Starter | Points: 25

Up
0
Down
protected void Button1_Click(object sender, EventArgs e)
{
string ex1 = "This Is Very Nice Place";
string[] txt = ex1.Split(' ');

for (int i = 0; i < txt.Count(); i++)
{
char[] strArray = txt[i].ToCharArray();
Array.Reverse(strArray);
string strReversed = new string(strArray);
TextBox2.Text = TextBox2.Text + " " + strReversed;
}
}

Ras90it, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Swapna901 on: 6/20/2012 [Member] Starter | Points: 25

Up
0
Down
private string RevesreString(string String)
{
string MainString = string.Empty;
MainString = String;
string ReverseString = string.Empty;
string[] split = MainString.Split(' ');

foreach(string str in split)
{

for (int i = str.Length - 1; i >= 0; i--)
{
ReverseString = ReverseString + str[i];
}
ReverseString = ReverseString + ' ';
}
Response.Write(ReverseString);
return ReverseString;
}

Ras90it, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response