s = "[A1]\n[A2]\n[A3]\n[A4]"; ArrayList l = new ArrayList(); while (s.IndexOf("\n") == 0) { l.Add(s.SubString(s.IndexOf("\n") + 1)); s = s.SubString(s.IndexOf("\n") + 1); } foreach (String s in l) { Console.WriteLine(s); }
string str=""[A1]\n[A2]\n[A3]\n[A4]"; foreach(string s in str.Split(new string[]{"\n"},StringSplitOptions.RemoveEmptyEntries)) {}
try...string test = "[A1]\n[A2]\n[A3]\n[A4]"; Regex reg = new Regex(@"(?s)\n(?=(.+))"); MatchCollection mc = reg.Matches(test); foreach (Match m in mc) { richTextBox2.Text += m.Groups[1].Value + "\n----------------------\n"; }
ArrayList l = new ArrayList();
while (s.IndexOf("\n") == 0)
{
l.Add(s.SubString(s.IndexOf("\n") + 1));
s = s.SubString(s.IndexOf("\n") + 1);
}
foreach (String s in l)
{
Console.WriteLine(s);
}
foreach(string s in str.Split(new string[]{"\n"},StringSplitOptions.RemoveEmptyEntries))
{}
Regex reg = new Regex(@"(?s)\n(?=(.+))");
MatchCollection mc = reg.Matches(test);
foreach (Match m in mc)
{
richTextBox2.Text += m.Groups[1].Value + "\n----------------------\n";
}