I am having NSString
value which I want to convert in unsigned long
. I used code below
NSString *updateId = [NSString stringWithFormat:@"%@",[tweet updateId]];
NSLog(@"%@",[tweet updateId]);
unsigned long tweetId = [updateId longLongValue];
NSLog(@"ButtonPressed: .......%llu",tweetId);
But it is not returning correct value...
The Cocoa way would be to use [NSNumberFormater]
1:
NSNumberFormatter* formatter = [[NSNumberFormatter alloc] init];
NSLog(@"%lu", [[formatter numberFromString:updateId] unsignedLongValue]);
[formatter release];
What's the the type of [tweet updateId]?
Does it contain any localization (e.g. thousand separators)?
If so, you could configure the NSNumberFormatter
instance with setLocale:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With