Created
December 14, 2012 06:48
-
-
Save mluton/4283232 to your computer and use it in GitHub Desktop.
Create string from unicode.
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
// Guaranteed to get the characters in the 'illegal' ranges the compiler will complain about. | |
NSMutableAttributedString *attrStr = [NSMutableAttributedString attributedStringWithString:[NSString stringWithFormat:@"%C", (unsigned short)0xe007]]; | |
// Same thing but use a string as the original source of the unicode instead of a literal. | |
unsigned int intValue; | |
NSScanner* scanner = [NSScanner scannerWithString:@"e007"]; | |
[scanner scanHexInt:&intValue]; | |
NSMutableAttributedString *attrStr = [NSMutableAttributedString attributedStringWithString:[NSString stringWithFormat:@"%C", (unsigned short)intValue]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment