10
Vorrei ottenere un valore dec da una stringa con codifica esadecimale, per esempi: A-> 10, B-> 11, ecc. e ho codificato come il seguenteCome ottenere un int in decimale da una NSString esadecimale
NSString *tempNumber;
tempNumber=number.text;
NSScanner *scanner=[NSScanner scannerWithString:tempNumber];
unsigned int temp;
[scanner scanHexInt:temp];
NSLog(@"%@:%d",tempNumber,temp);
ma l'uscita NSLog non è quello che prediligono ..
2012-01-24 01:34:57.703 TestingUnit[34861:f803] 4:-1073750472
2012-01-24 01:35:01.133 TestingUnit[34861:f803] 6:-1073750408
2012-01-24 01:35:01.983 TestingUnit[34861:f803] 2:-1073750408
2012-01-24 01:35:02.414 TestingUnit[34861:f803] 1:-1073750408
Qualcuno potrebbe dirmi come posso risolvere questo ????
modifica: non l'ho letto bene. – govi
possibile duplicato di [Objective C parse hex stringa in intero] (http://stackoverflow.com/questions/3648411/objective-c-parse-hex-string-to-integer) – vcsjones