[Previous]
[Up]
[Next]
NSNumber
Authors
- Richard Frith-Macdonald
-
Version: $Revision$
Date: $Date$
Declared in: Foundation/NSValue.h
Inherits from: NSValue
Conforms to: NSCoding
Instance Variables
Methods
Class Methods
+ (NSNumber*) numberWithBool: (BOOL)value;
+ (NSNumber*) numberWithChar: (char)value;
+ (NSNumber*) numberWithDouble: (double)value;
+ (NSNumber*) numberWithFloat: (float)value;
+ (NSNumber*) numberWithInt: (int)value;
+ (NSNumber*) numberWithLong: (long int)value;
+ (NSNumber*) numberWithLongLong: (long long int)value;
+ (NSNumber*) numberWithShort: (short int)value;
+ (NSNumber*) numberWithUnsignedChar: (unsigned char)value;
+ (NSNumber*) numberWithUnsignedInt: (unsigned int)value;
+ (NSNumber*) numberWithUnsignedLong: (unsigned long int)value;
+ (NSNumber*) numberWithUnsignedLongLong: (unsigned long long int)value;
+ (NSNumber*) numberWithUnsignedShort: (unsigned short int)value;
Instances Methods
- (BOOL) boolValue;
- (char) charValue;
- (NSComparisonResult) compare: (NSNumber*)aNumber;
- (NSDecimal) decimalValue;
- (NSString*) description;
Invokes descriptionWithLocale: using nil locale.
- (NSString*) descriptionWithLocale: (NSDictionary*)aLocale;
Produces a string representation of the number. For a boolean
this will be either 'true' or 'false'. For other numbers the
format is produced using the initWithFormat:locale:... method
of NSString, and the format depends on the type of number as
follows -
- char
- %i
- short
- %hi
- int
- %i
- long
- %li
- long long
- %li
- unsigned char
- %u
- unsigned short
- %hu
- unsigned int
- %u
- unsigned long
- %lu
- unsigned long long
- %lu
- float
- %0.7g
- double
- %0.16g
- (double) doubleValue;
- (float) floatValue;
- (id) initWithBool: (BOOL)value;
- (id) initWithChar: (char)value;
- (id) initWithDouble: (double)value;
- (id) initWithFloat: (float)value;
- (id) initWithInt: (int)value;
- (id) initWithLong: (long int)value;
- (id) initWithLongLong: (long long int)value;
- (id) initWithShort: (short int)value;
- (id) initWithUnsignedChar: (unsigned char)value;
- (id) initWithUnsignedInt: (unsigned int)value;
- (id) initWithUnsignedLong: (unsigned long int)value;
- (id) initWithUnsignedLongLong: (unsigned long long int)value;
- (id) initWithUnsignedShort: (unsigned short int)value;
- (int) intValue;
- (BOOL) isEqualToNumber: (NSNumber*)aNumber;
- (long long int) longLongValue;
- (long int) longValue;
- (short int) shortValue;
- (NSString*) stringValue;
Expivalent to descriptionWithLocale: using a nil locale.
- (unsigned char) unsignedCharValue;
- (unsigned int) unsignedIntValue;
- (unsigned long long int) unsignedLongLongValue;
- (unsigned long int) unsignedLongValue;
- (unsigned short int) unsignedShortValue;