unity检测字符串内有多少中文

以下是测试脚本,使用正则表达式检测

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;

public class TestScript : MonoBehaviour
{
    public string str;

    public void OnEnable()
    {
        foreach (Match m in Regex.Matches(str, "[\\u4E00-\\u9FA5\\uF900-\\uFA2D]"))
            Debug.Log(m.Value);
    }
}