string a="1,2,3,4,5,6"; string b = "1,4";List<string> listA = new List<string>(a.Split(',')); List<string> listB = new List<string>(b.Split(','));List<string> listC = listA.Except<string>(listB).ToList();
string a = "1,2,3,4,5,6"; string b = "1,4"; string c = string.Join(",", a.Split(',').Except(b.Split(','))); Console.WriteLine(c11);//2,3,5,6
Console.WriteLine(c);//2,3,5,6
string a = "1,2,3,4,5,6"; string b = "1,4"; a = string.Join(",", a.Split(',').Except(b.Split(',')).ToArray());
将a、b的内容都分割开来,然后找a中是否有b的元素,有的话用""替换就是
string txta = "", txtb = "", cc = ""; txta = a.Text.Trim().Trim(','); txtb = b.Text.Trim().Trim(','); string[] pp = txtb.Split(','); cc = "," + txta + ","; for (int i = 0; i < pp.Length; i++) { if (cc.Contains("," + pp[i] + ",")) { txtb = pp[i] + ","; txta = txta.Replace(txtb, ""); } } c.Text = txta.ToString();小弟不才给你回复一个!
private ArrayList aad() { string a = "1,2,3,4,5,6"; string b = "1,4"; string[] arra = a.Split(','); string[] arrb = b.Split(','); ArrayList newlist=new ArrayList(); foreach (string temp in arra) { if (!b.Contains(temp)) { newlist.Add(temp); } } return newlist; }
查找--》替换--》填到新的string[] Arr中
var aaa = new string("123456789".ToArray().Except("159".ToArray()).ToArray()); 公历→农历 2013年06月06日 双子座 二〇一三年四月廿八 癸巳〖蛇〗 丁巳月 癸卯日 壬亥时 今属:水;五行:水火木;缺:土金。
string a="1,2,3,4,5,6";
string b = "1,4";List<string> listA = new List<string>(a.Split(','));
List<string> listB = new List<string>(b.Split(','));List<string> listC = listA.Except<string>(listB).ToList();
string a = "1,2,3,4,5,6";
string b = "1,4";
string c = string.Join(",", a.Split(',').Except(b.Split(',')));
Console.WriteLine(c11);//2,3,5,6
string a = "1,2,3,4,5,6";
string b = "1,4";
a = string.Join(",", a.Split(',').Except(b.Split(',')).ToArray());
string txta = "", txtb = "", cc = "";
txta = a.Text.Trim().Trim(',');
txtb = b.Text.Trim().Trim(',');
string[] pp = txtb.Split(',');
cc = "," + txta + ",";
for (int i = 0; i < pp.Length; i++)
{
if (cc.Contains("," + pp[i] + ","))
{
txtb = pp[i] + ",";
txta = txta.Replace(txtb, "");
}
}
c.Text = txta.ToString();小弟不才给你回复一个!
{
string a = "1,2,3,4,5,6";
string b = "1,4";
string[] arra = a.Split(',');
string[] arrb = b.Split(',');
ArrayList newlist=new ArrayList();
foreach (string temp in arra)
{
if (!b.Contains(temp))
{
newlist.Add(temp);
}
}
return newlist;
}
公历→农历
2013年06月06日
双子座
二〇一三年四月廿八
癸巳〖蛇〗 丁巳月 癸卯日 壬亥时
今属:水;五行:水火木;缺:土金。