Hi
I try to take a string from multi line text box call "ReqText"
Reverse the string, then take him again to the text box
It is works, my problem is that: from multiline text it is became to single line
My code:
char[] arr = ReqText.Text.ToCharArray(); // converting the textbox to char arrayArray.Reverse(arr); // reversing the text
ReqText.Text = strReversed;
string strReversed = new string(arr);
any help?
I try to repeat the reverse string as muliline again
Thanks,
Loading
Prabhu RajaPosted Aug 31, 2011, 5:12 AM
Its Working According to your needs.
string[] lines = ReqText.Text.Split(new string[] { "\r\n" }, StringSplitOptions.None);
for (int i = lines.Length-1; i >=0; i--)
{
Char[] chars = lines[i].ToCharArray();
Array.Reverse(chars);
lines[i] = new string(chars);
}
ReqText.Text = String.Join("\r\n", lines);
jacobahPosted Aug 31, 2011, 5:52 AM
VulpesPosted Aug 31, 2011, 5:00 AM
VulpesPosted Aug 31, 2011, 4:53 AM
jacobahPosted Aug 31, 2011, 4:48 AM
it's gave me direction
simply when i write:
thank
you
I expect to:
Knaht
Uoy
instead of
you
thank
Prabhu RajaPosted Aug 31, 2011, 2:51 AM
Find Attachment.
//import .net framework packages in your class
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
Your Code Here...
string[] lststr = this.ReqText.Text.Split(new Char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
ArrayList arraylist = new ArrayList();
arraylist.Add(this.ReqText.Text.Split(new Char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries));
string reverse = String.Empty;
for (int i = 0; i < arraylist.Count; i++)
{
for (int j = lststr.Length-1; j > -1; j--)
{
reverse += lststr[j] + '\r' + '\n';
}
}
this.ReqText.Text = reverse;
thank you.