日期:2014-05-17 浏览次数:20429 次
string A1 = "abc,efg,hik,lmn,opq";
string B1= "efg,d3l,opq,LMn";
输出:efg,opq
string A1 = "abc,efg,hik,lmn,opq";
string B1 = "efg,d3l,opq,LMn";
string[] arr = A1.Split(',').Select(x => x).Where(y => B1.Split(',').Contains(y)).ToArray();
string A1 = "abc,efg,hik,lmn,opq";
string B1 = "efg,d3l,opq,LMn";
string C1 = string.Join(",", A1.Split(',').Intersect(B1.Split(',')).ToArray());