INNER CODE UNIT · Dart
convertCharToTraditionalChinese
flutterchina/lpinyin · lib/src/chinese_helper.dart:46
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;
}
}
}
return c;
}
/// 将繁体字转换为简体字
/// @param str 需要转换的繁体字
/// @return 转换后的简体字
static String convertToSimplifiedChinese(String str) {
StringBuffer sb = StringBuffer();