开发者

how to convert UITextfield into hex value

开发者 https://www.devze.com 2023-03-18 07:48 出处:网络
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 ...

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号