INNER CODE UNIT · Dart
convertCharToSimplifiedChinese
flutterchina/lpinyin · lib/src/chinese_helper.dart:38
static String convertCharToSimplifiedChinese(String c) {
String? simplifiedChinese = chineseMap[c];
return simplifiedChinese ?? c;
}
/// 将单个简体字转换为繁体字
/// @param c 需要转换的简体字
/// @return 转换后的繁字体
static String convertCharToTraditionalChinese(String c) {
if (chineseMap.containsValue(c)) {
Iterable<MapEntry<String, String>> iterable = chineseMap.entries;
for (int i = 0, length = iterable.length; i < length; i++) {
MapEntry<String, String> entry = iterable.elementAt(i);
if (entry.value == c) {
return entry.key;
}
}
}