This is how you can work with ASCII values and NSString
. Note that since NSString
is working with unichars, there could be unexpected results for a non ASCII string.
// NSString to ASCII
NSString *string = @"A";
int asciiCode = [string characterAtIndex:0]; // 65
// ASCII to NSString
int asciiCode = 65;
NSString *string = [NSString stringWithFormat:@"%c", asciiCode]; // A
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…