INNER CODE UNIT · Dart

chineseRegexp

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

  static final RegExp chineseRegexp = RegExp(chineseRegex);
  static final Map<String, String> chineseMap =
      PinyinResource.getChineseResource();

  /// 判断某个字符是否为汉字
  /// @return 是汉字返回true,否则返回false
  static bool isChinese(String c) {
    return '〇' == c || chineseRegexp.hasMatch(c);
  }

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

  /// 判断字符串中是否包含中文

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…