概述
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
string str = "fdsa汉jklfda字ljklfdsa提jkflds取ljfjkds";
string newstr = "";
Regex rg = new Regex(@"[/u4e00-/u9fa5]");
for (int ii = 0; ii < str.Length; ii++)
{
string val = str.Substring(ii, 1);
if (rg.IsMatch(val))
{
newstr += val;
}
}
Console.WriteLine(newstr);
Console.Read();
}
}
}
{
class Program
{
static void Main(string[] args)
{
string str = "fdsa汉jklfda字ljklfdsa提jkflds取ljfjkds";
string newstr = "";
Regex rg = new Regex(@"[/u4e00-/u9fa5]");
for (int ii = 0; ii < str.Length; ii++)
{
string val = str.Substring(ii, 1);
if (rg.IsMatch(val))
{
newstr += val;
}
}
Console.WriteLine(newstr);
Console.Read();
}
}
}
最后
以上就是踏实鸡为你收集整理的汉字提取(C#)的全部内容,希望文章能够帮你解决汉字提取(C#)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复