/SwiftZhConverter

Convert between traditional and simplified Chinese in Swift

Primary LanguageSwiftMIT LicenseMIT

SwiftZhConverter 簡介

一個可幫助執行中文繁簡轉換的 Swift Library。轉換原理是基於字轉換,也就是針對每個中文字碼進行轉換動作,字碼對照表採用同文堂 所整理開放出來的中文字碼對照表。

程式範例

// 轉換繁體中文為簡體中文︰
// 圖書館員是很清閒的工作嗎? -> 图书馆员是很清闲的工作吗?
var converter = ZhConverterFactory.getConverter(ZhCode.SIMPLIFIED)
converter.convert("圖書館員是很清閒的工作嗎?")

// 轉換簡體中文為繁體中文:
// 图书馆员是很清闲的工作吗? -> 圖書館員是很清閒的工作嗎?
var converter = ZhConverterFactory.getConverter(ZhCode.TRANDITIONAL)
converter.convert("图书馆员是很清闲的工作吗?")

參考資料

SwiftZhConverter Introduction

Based on the character map found in Tong Wen Tang to convertt String between traditional and simplified Chinese characters.

Examples

// Tranditional To Simplified:
// 圖書館員是很清閒的工作嗎? -> 图书馆员是很清闲的工作吗?
var converter = ZhConverterFactory.getConverter(ZhCode.SIMPLIFIED)
converter.convert("圖書館員是很清閒的工作嗎?")

// Simplified To Tranditional:
// 图书馆员是很清闲的工作吗? -> 圖書館員是很清閒的工作嗎?
var converter = ZhConverterFactory.getConverter(ZhCode.TRANDITIONAL)
converter.convert("图书馆员是很清闲的工作吗?")

References