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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to