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?

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.

@Mitja
What is wrong with StringBuilder and append?

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 :)

Ya, i got it. Thank you very much.

@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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.