2012-01-23 25 views
10

16進数でエンコードされた文字列の からA-10、B-> 11などのdec値を取得したいと考えています。16進数のNSStringから10進数を取得する方法

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 

誰かがどのように私はこの問題を解決することができます私に言うことができる... と私は次の

NSString *tempNumber; 
tempNumber=number.text; 
NSScanner *scanner=[NSScanner scannerWithString:tempNumber]; 
unsigned int temp; 
[scanner scanHexInt:temp]; 
NSLog(@"%@:%d",tempNumber,temp); 

としてコード化されたが、のNSLog出力は、私がperferものではありません????

+0

編集:didntよく読んでください。 – govi

+2

[Objective Cが16進文字列を整数に解析]の重複可能性(http://stackoverflow.com/questions/3648411/objective-c-parse-hex-string-to-integer) – vcsjones

答えて

13

あなたは

[scanner scanHexInt:&temp]; 

scanHexInt:がポインタではなく、価値を見込んで使用する必要があります。

関連する問題