Mariusz
BAN USERhttp://pl.linkedin.com/in/rmariusz
string f = "926";
HashSet<string> data = new HashSet<string>();
data.Add("2916");
data.Add("932678");
data.Add("92678");
data.Add("222222");
data.Add("722629");
data.Add("9777726");
data.Add("926926");
bool isToDisplay;
int lastInx;
foreach (var d in data)
{
lastInx = 0;
isToDisplay = true;
foreach (var i in f.Select((v, i) => new { Value = v, Index = i }))
{
if (!d.Contains(i.Value) || (lastInx > d.IndexOf(i.Value))) { isToDisplay = false; break; }
lastInx = d.IndexOf(i.Value);
}
if (isToDisplay) Debug.WriteLine(d);
}
when you insert 629, 296, 269 is also matched although shouldn't it.
- Mariusz June 25, 2012