C# 判断字符串中是否含有指定字符串

用contains

example:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = "abc平行线";
            Console.WriteLine(a.Contains("平行线"));
        }
    }
}

 

你可能感兴趣的:(C#)