Hi,
Lets consider the Example i have a string "Hello welcome to ASPFormus"
i wnat the output has "oiieh emoclew ot sumrofPSA"
Can u plz help me out ....
Thanks In Advance
NIthin
Please refer this
protected void Page_Load(object sender, EventArgs e) { // using for loop string str = "Hello welcome to ASPFormus"; char[] characters = str.ToCharArray(); string reverse = string.Empty; ; for (int i = str.Length - 1; i >= 0; --i) { reverse += characters[i].ToString(); } //using Reverse function char[] charArray = str.ToCharArray(); Array.Reverse(charArray); string rev = new string(charArray); }
Image:
Thank You.
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { string str = "Hello this is Nithin"; string[] arrayStr = str.Split(' '); string reverseWords = string.Empty; for (int i = 0; i < arrayStr.Length; i++) { reverseWords += Reverse(arrayStr[i]) + " "; } } } private string Reverse(string str) { char[] characters = str.ToCharArray(); string reverse = string.Empty; ; for (int i = str.Length - 1; i >= 0; --i) { reverse += characters[i].ToString(); } return reverse; }
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.