INNER CODE UNIT · Dart
ChineseHelper
flutterchina/lpinyin · lib/src/chinese_helper.dart:4
class ChineseHelper {
static const String chineseRegex = "[\\u4e00-\\u9fa5]";
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);
}