Re: converting from decimal to hexadecimal
Re: converting from decimal to hexadecimal
- Subject: Re: converting from decimal to hexadecimal
- From: "Ronnie B" <email@hidden>
- Date: Tue, 2 Sep 2008 14:12:10 -0400
That was it. Thanks Gregory.
On Tue, Sep 2, 2008 at 2:08 PM, Gregory Weston <email@hidden> wrote:
> On Sep 2, 2008, at 2:04 PM, Ronnie B wrote:
>
> Ok. In my code I have this:
>> NSString *str = [NSString stringWithFormat:@"%x", [NSNumber
>> numberWithInt:12345]];
>> NSLog(@" --- hex or not %@", str);
>>
>> in a concole I see this:
>> --- hex or not 5c633d0
>>
>> But, in Calculator.app I see this: 0x3039
>>
>> What i am doing wrong?
>>
>
> You're passing a pointer to an object representing a numeric value, not the
> numeric value proper. If you want the integer from an NSNumber you'd have to
> send it an intValue (or similar) message.
>
> NSString* str = [NSString stringWithFormat:@"%x", 12345];
>
> should get you what you want.
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden