i have a problem to separate the 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..

List<String> mySecondList = new List<String>();
List<String> myThirdList = new List<String>();

foreach (String s in myFirstList) {
    int i = s.LastIndexOf(' ');
    if (i >= 0) {
        mySecondList.Add(s.Substring(0, i));
        myThirdList.Add(s.Substring(i+1));
    } else {
        mySecondList.Add(s);
        myThirdList.Add(String.Empty);
    }
}
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.