- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace _1
- {
- class Program
- {
- static void Main(string[] args)
- {
- //不用循环,如何判断字符串A=“1,2,34,5”中是否包含字符‘2’(A之间用逗号分开)
- string a = "1,2,34,5";
- if (a.Contains('2'))
- {
- Console.WriteLine("包含");
- }
- else
- {
- Console.WriteLine("不包含");
- }
- Console.ReadKey();
- }
- }
- }
复制代码 |