1. 使用表达式方式:
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
  }
      string a = "1,2,3,4,5,6";
  List<string> oTempList = new List<string>(a.Split(','}));
  if(oTempList.Contains(“3"))
  {
   //字符串数据A中包含字符串元素B
  }
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-11-17
  • 2021-09-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2021-10-02
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案