Such as string str = "1,21,32,44,55"
If the direct comma + contains the string is determined, then, for example, "1," there will be problems, there are two methods
if (strt.StartsWith(name+",")|| strt.Contains(","+name+",")|| str.EndsWith(","+name)) { } ////////////////////////方式1////////////////////////////// String[] listValues = strSplit(','); if (listValues.Contains(name)) { }
////////////////////////方式2////////////////////////////////