[NSString longLongValue]
Returns the
long long
value of the receiver’s text.
- (long long)longLongValue
Return Value
The
long long
value of the receiver’s text, assuming a decimal representation and skipping whitespace at the beginning of the string. Returns LLONG_MAX
orLLONG_MIN
on overflow. Returns 0
if the receiver doesn’t begin with a valid decimal text representation of a number.Discussion of [NSString longLongValue]
This method uses formatting information stored in the non-localized value; use an
NSScanner
object for localized scanning of numeric values from a string.
Example of [NSString longLongValue]
NSString * theString = [[[_message objectForKey:@"user"] objectForKey:@"id"];
NSNumberFormatter * numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
NSNumber * number = [numberFormatter numberFromString:theString];
NSLog(@"%llu", [number unsignedLongLongValue]);
Example of [NSString longLongValue]
NSString *numStr = [NSString stringWithFormat:@"%llu", [myNum unsignedLongLongValue]];
// .. code and time in between when numStr was created
// .. and now needs to be converted back to a long long.
// .. Therefore, numStr used below does not imply the same numStr above.
unsigned long long ullvalue = strtoull([numStr UTF8String], NULL, 0);
Example of [NSString longLongValue]
long long int numC;
//Number formatter and string operations
numC = [valuestring longLongValue];
NSString *results = [formatter stringFromNumber:[NSNumber numberWithLongLong: numC]];
label1.text = results;