INNER CODE UNIT · Dart

isChinese

flutterchina/lpinyin · lib/src/chinese_helper.dart:12

  static bool isChinese(String c) {
    return '〇' == c || chineseRegexp.hasMatch(c);
  }

  /// 判断某个字符是否为繁体字
  /// @param c 需要判断的字符
  /// @return 是繁体字返回true,否则返回false
  static bool isTraditionalChinese(String c) {
    return chineseMap.containsKey(c);
  }

  /// 判断字符串中是否包含中文
  /// @param str 字符串
  /// @return 包含汉字返回true,否则返回false
  static bool containsChinese(String str) {
    for (int i = 0, len = str.length; i < len; i++) {
      if (isChinese(str[i])) {
        return true;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…