static void Main(string[] args)
         {
            string str = "asd=-.我是中文{asdasd";
            Console.WriteLine(GetChineseWord(str));
            Console.ReadKey();

         }
          public static string GetChineseWord(string oriText)
          {
            string x = @"[\u4E00-\u9FFF]+";
            MatchCollection Matches = Regex.Matches
            (oriText, x, RegexOptions.IgnoreCase);
            StringBuilder sb = new StringBuilder();
            foreach (Match NextMatch in Matches)
            {
                sb.Append(NextMatch.Value);
            }
            return sb.ToString();
          }    

很简单,不想废话,最终控制台输出的就是“我是中文”这几个字

相关文章:

  • 2022-02-19
  • 2021-11-20
  • 2021-07-23
  • 2022-02-16
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-17
  • 2022-01-25
  • 2022-12-23
  • 2022-02-07
  • 2021-07-23
相关资源
相似解决方案