var s1 = "1,2,3,4,5"; var s2 = "3,4"; s1 = s1.Replace(s2, string.Empty).Replace(",,",",");
char[] delimiterChars = { ',' }; string a = "1,3,2,4,5"; string b = "3,4"; string[] A = a.Split(delimiterChars); string[] B = b.Split(delimiterChars); List<string> C = A.Except<string>(B).ToList(); string c = string.Join(",", C);
for (int i = 0; i < s1.Length; i++) { int count = 0; if (s1[i] != ',') { for (int j = 0; j < s2.Length; j++) { if (s1[i].ToString() == s2[j].ToString()) { count++; } } if (count == 0) s3 += s1[i].ToString() + ','; } } s3.Remove(s3.Length - 1);
string s1 = "1,2,3,4,5"; string s2="2,3"; var res1 = s1.Split(','); var res2 = s2.Split(','); string res = ""; for(int i=0;i<res1.count();i++)> { for(int j=0;j<res2.count();> { if (res1[i] == res2[j]) { break; } else { if ((j == (res2.Count() - 1))) { res = res + res1[i].ToString() + ","; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)