最好用的汉字转拼音代码PinYin4Objc(PinYin4J的objc版本)

转:https://github.com/kimziv/PinYin4Objc

最好用的汉字转拼音代码PinYin4Objc(PinYin4J的objc版本)(更新到v1.1.1,增加block异步处理)

2013-10-08,更新到 V1.1, add async methods whit block, solve ui blcoking problems and fix some cache bugs;


1. -(void)cacheObjec:(id<NSCoding>)obj forKey:(NSString *)key; 這個方法裡頭,NSData writeToFile

  我修改成了,dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{};



2. 我在PinyinHelper里增加了async方法,ui放到block里更新,不再会产生ui阻塞的情况了;



3.修复了创建cache文件时,no such a file or directory的错误;



-----------------------------华丽的分割线-------------------------------------------------------------------------------







PinYin4Objc 是一个流行的汉字(支持简体和繁体)转拼音的objc库,有以下特性:

1.效率高,使用数据缓存,第一次初始化以后,拼音数据存入文件缓存和内存缓存,后面转换效率大大提高;

2.支持自定义格式化,拼音大小写等等;

3.拼音数据完整,支持中文简体和繁体,与网络上流行的相关项目比,数据很全,几乎没有出现转换错误的问题。



PinYin4Objc is a popular objective-c library supporting convertion between Chinese(both Simplified and Tranditional) characters and most popular Pinyin systems, it's performance is very efficient, data cached at first time. The output format of pinyin could
be customized.



性能比较:

与之前的pinyin,POAPinyin和PYMethod等项目比较,PinYin4Objc的速度是非常快的,差不多为:0.20145秒/1000字, 如下图

[attachment=57828]

PinYin4Objc源码 [attachment=57865]






项目地址:
https://github.com/kimziv/PinYin4Objc

上一篇:InnoDB和Foreign KEY Constraints


下一篇:【Android进阶】URL与URI的区别