Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Code to display input in reverse within the C# forums, part of the Software Development category; Dear fnds, i have 2 text boxes 1 button, my question is i am entering (example 123 or abc ) in 1st textbox, when i click button then ( 321 ...
|
|||||||
|
|||
|
Code to display input in reverse
Dear fnds,
i have 2 text boxes 1 button, my question is i am entering (example 123 or abc ) in 1st textbox, when i click button then ( 321 or cba ) will dispaly in 2nd textbox. please tell how to write code for this. cheers |
| The Following 2 Users Say Thank You to bsrreddy For This Useful Post: | ||
| Sponsored Links |
|
|||
|
Re: Code to display input in reverse
Quote:
int a = Textbox1.Text.Length; string b = ""; for(int i=a;i>0;i--) { b = b+""+Textbox1.Text.Substring(i-1, 1).ToString(); } Textbox2.Text = b; |
|
|||
|
I could not find the Reverse function
. Though created my own function using a for loop.private string reverse(string str) { string rev = string.Empty; for (int i=str.Length-1; i>=0;i--) { rev += str[i]; } return rev; } try using this. |
|
|||
|
Re: Code to display input in reverse
Quote:
int p=s.Length; if(p!=0) { string k; for(int t=1;t<=p;t++) { k=s.Substring(p-t); textBox2.Text+=k;//you get the reverse order in this text box2 int q=s.Length; int w=0; string r=s.Remove(q-1,w+1); s=r; } } |
| The Following User Says Thank You to sudhakarr.net For This Useful Post: | ||
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I need to reverse the bits in a short integer | Geek_Guest | C and C++ | 2 | 10-02-2008 10:16 AM |
| write a program to reverse a string with/with out reverse() method? | ramakris143 | Java | 7 | 11-24-2007 06:33 AM |
| reverse number | mcamuthu | C and C++ | 6 | 08-06-2007 08:16 AM |
| How do I reverse a string with sql query only? | swanand11may | SQL | 4 | 07-09-2007 05:15 AM |
| Need predefined Function or code for Data Display in PHP | norman | PHP | 0 | 07-17-2006 04:17 PM |