For example'
i got data in String array
"1 2"
"1 2 3"
"2 3"
.......
But, after i split the data
All will become like this
1
2
1
2
3
2
3
but this is not i want..
the expected output that i want is like this
Output 1
1
2
output2
1
2
3
output3
2
3
and so on......this is my coding. hope someone can help me to solve this problem
List> P = new List>(itemS.ToList());
KeyitemS.Clear();
String[] SplitA;
String[] SplitB;
List l = new List();
foreach (KeyValuePair pair in P)
{
KeyitemS.AppendText(pair.Key + ":" + pair.Value + "\r\n");
l.Add(pair.Key);
}
String ink ="";
List U =new List();
foreach (String inter in l)
{
// MessageBox.Show(inter);
SplitA = inter.Split(' ');
SplitB = new String[SplitA.Length];
for (int i = 0; i < SplitA.Length; i++)
{
SplitB[i] = SplitA[i];
U.Add(SplitB[i]);
}
HashSet hset1 = new HashSet(v);
HashSet hset2 = new HashSet(U);
hset1.IntersectWith(hset2);
foreach (string inter1 in hset1)
{
ink += inter1;
}
MessageBox.Show(ink);
Suthish NairPosted Apr 2, 2011, 11:04 AM
string[] s1 = { "1 2" };
string[] s2 = { "1 2 3" };
string[] s3 = { "2 3" };
List
s.Add(s1);
s.Add(s2);
s.Add(s3);
for (int i = 0; i < s.Count; i++)
{
Console.WriteLine("Output " + (i + 1));
foreach (string item in s[i][0].ToString().Split(' '))
{
Console.WriteLine(item.Trim());
}
}
Console.ReadLine();