- 使用表达式方式:
string s = "12,123,1234,32,321,345";
if (s.Split(',').Any(x => x == "12"))
//存在
2.
string a = "1,2,3,4,5,6";
if(a.IndexOf(“3,")>-1)
{
//字符串A中包含字符串B
{
//字符串A中包含字符串B
}
string a = "1,2,3,4,5,6";
List<string> oTempList = new List<string>(a.Split(','}));
if(oTempList.Contains(“3"))
{
//字符串数据A中包含字符串元素B
}
if(oTempList.Contains(“3"))
{
//字符串数据A中包含字符串元素B
}