how to convert UITextfield into hex value
I am wanting to xor (^) two values and pass the result to an integer. Both values are being passed in from UITextFields, the first like so ...
NSString *recieveCode = myCode.text;
int tempCode = [recie开发者_JS百科veCode intValue];
however the second value coming in needs to be converted to hex.... which I am not sure how to do.. (obviously I will have to do some checking at some point to make sure all characters in the string conform to hex format) but for now I am just trying to figure out how to cast the text in the uitextfield is hex format so I can try ^ the two values together.
unsigned int intValue;
NSScanner *scanner = [NSScanner scannerWithString:aString];
[scanner scanHexInt:&intValue];
unsigned int tempInt = 0;
NSString *recieveCode = myCode.text;
int tempCode = [recieveCode intValue];
NSScanner * scanner = [NSScanner scannerWithString:recieveCode];
[scanner scanHexInt:&tempInt];
精彩评论