Re: Strange int behavour
Re: Strange int behavour
- Subject: Re: Strange int behavour
- From: John Stiles <email@hidden>
- Date: Tue, 23 Jan 2007 14:17:21 -0800
The docs say intValue returns INT_MAX on overflow; the number you're
seeing is INT_MAX.
"23456789" doesn't overflow an integer, though, so I'm a little
stumped. Is the actual value really 23456789, or is it a number
larger than 2 billion?
On Jan 23, 2007, at 2:04 PM, d2kagw wrote:
hi all,
I'm having some really strange issues with converting a NSString to
an int.
Examine the following peice of code, and
// declared elsewhere
NSString * theKey = @"A23456789";
// problem code
NSString * ttSession = [theKey substringWithRange:NSMakeRange( 1,
( [theKey length] - 1 ) )];
NSLog ( @"%@ == %i", ttSession, [ttSession intValue] );
now I was hoping that it would result in this
"23456789 == 23456789"
but instead I get
"23456789 == 2147483647"
and just to make it totally confusing, if I change "theKey" to
something different I still get "2147483647" as the value???
im totally stumped, and im sure its going to be something totally
silly like "you forgot a comma" or something :D
Cheers
Az
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40blizzard.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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