如果在一段字符串文本中得到所有中文字符的话,可以使用下边程序来实现。
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();
}
{
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();
}