Created
February 5, 2014 22:50
-
-
Save OneSadCookie/8834981 to your computer and use it in GitHub Desktop.
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
NSUInteger lengthA = [a length]; | |
NSUInteger lengthB = [b length]; | |
NSUInteger keyLength = lengthA + lengthB + 1; | |
assert(keyLength * sizeof(unichar) < SOME_REASONABLE_MAXIMUM_FOR_STACK_ALLOCATION); | |
unichar cat[keyLength]; | |
[a getCharacters:cat range:NSMakeRange(0, lengthA)]; | |
cat[lengthA] = '.'; | |
[b getCharacters:cat + lengthA + 1 range:NSMakeRange(0, lengthB)]; | |
NSString *key = [[NSString alloc] initWithCharactersNoCopy:cat length:keyLength freeWhenDone:NO]; | |
... [dict objectForKey:key]; | |
[key release]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment