i have a problem to separate last number from arrayList.
my exist arrayList are shown below:
1 2
1 3
1 2
2 3
1 2 3
1 3
2 3
1 2 3
may i know how to separate the last number, and store it into 2 araryList?
my expected output is
1st arraylist :
1
1
1
2
1 2
1
2
1 2
my second arrayList is:
2
3
2
3
3
3
3
3
hope someone can help me.
Loading

VulpesRank #55 · 29.2K reputationPosted Apr 8, 2011, 2:41 PM EDT
If it does, I'd try instead:
foreach (string s in richTextBox11.Lines)
{
int len = s.Length;
if (len == 0) continue;
al2.Add(s.Substring(0, len - 2));
al3.Add(s.Substring(len - 1));
}
VulpesRank #55 · 29.2K reputationPosted Apr 8, 2011, 2:09 PM EDT
y s62 reputationPosted Apr 8, 2011, 2:33 PM EDT
ArrayList al2 = new ArrayList();
ArrayList al3 = new ArrayList();
foreach (string s in richTextBox11.Lines)
{
int len = s.Length;
al2.Add(s.Substring(0, len - 2));
al3.Add(s.Substring(len - 1));
}
richTextBox15.Clear();
foreach (string s in al2)
{
richTextBox15.AppendText(s);
}
richTextBox16.Clear();
foreach (string s in al3)
{richTextBox16.AppendText(s);
}
M i make some mistake?
y s62 reputationPosted Apr 8, 2011, 2:56 PM EDT
Suthish NairRank #92 · 22.8K reputationPosted Apr 8, 2011, 10:15 PM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Apr 9, 2011, 12:16 PM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Apr 9, 2011, 12:45 PM EDT