hi,I work using window form C#, my problem is as below:

 output += myArray1[prune];
 string ipt = null;
                    while ((ipt=re.ReadLine()) != null)
                    {
                        string ListSplitLineByLine1 = "";
                        String[] SplitItemLineByLine2 = (ipt).Split(new string[] { "\n\r\t", " " }, StringSplitOptions.None);

                        foreach (string lineByLine1 in SplitItemLineByLine2)
                        {
                            ListSplitLineByLine1 += "\r\n" + lineByLine1;
                        }
                        StoreRoom.Text = ListSplitLineByLine1.Trim();                       
                    }

I wan split the the string "12345" become line by line as below:

1
2
3
4
5

However after i execute it still the same, what is the problem of my coding?

Edited 3 Years Ago by mike_2000_17: Fixed formatting

There is nothing between the numbers to split on. If you know they are all just a single character, then you can do:

StringBuilder sb = new StringBuilder();
foreach (char c in ipt) {
    sb.AppendLine(c);
}
StoreRoom.Text = sb.ToString();

maybe a bit off topic..

Momerath: ... StringBuilder!!! :)
dont use any array, or "appanding" a text to a text, like myString +=something!

:)
I have learned that now.

To split a string like "12345" in other strings is not possible.
You can split a string in chars if you want to.

Momerath: ... StringBuilder!!! :)
dont use any array, or "appanding" a text to a text, like myString +=something!

:)
I have learned that now.

It becomes a habit after a while :)

@Mitja
What is wrong with StringBuilder and append?

LOL, you dont get it, me and Momerath had some issues in the past, I was constantly using apending string to string. And he then tought me to use StringBuilder instead.
Thx for that Momerath.
Appreciate it.
Mitja

This question has already been answered. Start a new discussion instead.