using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 字符串过滤
{
class Program
{
static void Main(string[] args)
{
List<string> strList = new List<string>();
strList.Add("按键1");
strList.Add("按键2");
strList.Add("按键3");
strList.Add("其他");
foreach (string a in strList)
{
Console.WriteLine(a);
}
Console.WriteLine("数组长度:"+strList.Count.ToString());
Console.WriteLine();
string str_Arr = "anjian1,按键2,按键3" ;
char [] ch = new char[] { ',', ',' };
foreach(string filter in str_Arr.Split(ch,StringSplitOptions.RemoveEmptyEntries))
{
strList.Remove(filter);
}
foreach(string a in strList)
{
Console.WriteLine(a);
}
Console.WriteLine("数组长度:" + strList.Count.ToString());
Console.ReadKey();
}
}
}