CCBridge // +convertPunctuationsToVertical().

This commit is contained in:
ShikiSuen 2022-08-27 22:48:38 +08:00
parent a0400c111a
commit 80c0721a28
1 changed files with 17 additions and 0 deletions

View File

@ -11,6 +11,23 @@ import Foundation
public enum ChineseConverter { public enum ChineseConverter {
public static let shared = HotenkaChineseConverter(plistDir: mgrLangModel.getBundleDataPath("convdict")) public static let shared = HotenkaChineseConverter(plistDir: mgrLangModel.getBundleDataPath("convdict"))
private static var punctuationConversionTable: [(String, String)] = [
("", ""), ("", ""), ("", ""), ("", ""), ("", ""), ("", ""), ("", ""), ("", ""),
("", "︿"), ("", ""), ("", ""), ("", ""), ("", ""), ("", ""), ("", ""), ("", ""),
]
///
/// 使使
/// - Parameters:
/// - target:
/// - convert:
public static func hardenVerticalPunctuations(target: inout String, convert: Bool = false) {
guard convert else { return }
for neta in ChineseConverter.punctuationConversionTable {
target = target.replacingOccurrences(of: neta.0, with: neta.1)
}
}
// JIS // JIS
private static func processKanjiRepeatSymbol(target: inout String) { private static func processKanjiRepeatSymbol(target: inout String) {
guard !target.isEmpty else { return } guard !target.isEmpty else { return }