Code Monkey home page Code Monkey logo

enjoecn / pinyin4objc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kimziv/pinyin4objc

0.0 0.0 0.0 270 KB

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, and use async method with block, this can avoid ui blocking, and runs smoothly. The output format of pinyin could be customized.(关键字:汉字转拼音,中文转拼音)

Home Page: http://github.kimziv.com/

License: Apache License 2.0

Ruby 2.78% Objective-C 97.22%

pinyin4objc's Introduction

PinYin4Objc

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, you can use async method with block, this can avoid ui blocking, and runs smoothly. The output format of pinyin could be customized.

*update

2013-10-08, V1.1, add async methods whit block, solve ui blcoking problems and fix some cache bugs; 2013-09-16, V1.0, firt virsion published.

  • Usage

1.use async method with block, this can avoid ui blocking, and runs smoothly:

	NSString *sourceText=@"我爱中文";
	HanyuPinyinOutputFormat *outputFormat=[[HanyuPinyinOutputFormat alloc] init];
	[outputFormat setToneType:ToneTypeWithoutTone];
	[outputFormat setVCharType:VCharTypeWithV];
	[outputFormat setCaseType:CaseTypeLowercase];    
	[PinyinHelper toHanyuPinyinStringWithNSString:sourceText 
					   withHanyuPinyinOutputFormat:outputFormat 
									   withNSString:@" " 
									   outputBlock:^(NSString *pinYin) {
  		_outputTv.text=pinYin; //update ui

	 }];

2.use sync method below:

	NSString *sourceText=@"我爱中文";
	HanyuPinyinOutputFormat *outputFormat=[[HanyuPinyinOutputFormat alloc] init];
	[outputFormat setToneType:ToneTypeWithoutTone];
	[outputFormat setVCharType:VCharTypeWithV];
	[outputFormat setCaseType:CaseTypeLowercase];
	NSString *outputPinyin=[PinyinHelper toHanyuPinyinStringWithNSString:sourceText withHanyuPinyinOutputFormat:outputFormat withNSString:@" "];
  • ScreenShot

    ScreenShot

pinyin4objc's People

Contributors

kimziv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.