Created
July 1, 2013 11:10
-
-
Save ksm/5900007 to your computer and use it in GitHub Desktop.
Transliterate and normalize alphabets to latin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: WWDC 2013 Session 228 | |
CFMutableStringRef string = (__bridgeCFMutableStringRef)[@"Hello!こんにちは!สวสัดี!مرحبا!您好!" mutableCopy]; | |
CFStringTransform(string, NULL, kCFStringTransformToLatin, NO); | |
// Hello! kon'nichiha! swạsdī! mrḥbạ! nín hǎo! | |
CFStringTransform(string, NULL, kCFStringTransformStripCombiningMarks, NO); | |
// Hello! kon'nichiha! swasdi! mrhba! nin hao! | |
CFStringLowercase(string, NULL); | |
// hello! kon'nichiha! swasdi! mrhba! nin hao! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment