[Previous] [Up] [Next]

NSNumber

Authors

Richard Frith-Macdonald

Version: $Revision$

Date: $Date$

NSNumber

NSNumber

Declared in: Foundation/NSValue.h

Inherits from: NSValue

Conforms to: NSCoding


Instance Variables

Methods


Class Methods

numberWithBool:

+ (NSNumber*) numberWithBool: (BOOL)value;

numberWithChar:

+ (NSNumber*) numberWithChar: (char)value;

numberWithDouble:

+ (NSNumber*) numberWithDouble: (double)value;

numberWithFloat:

+ (NSNumber*) numberWithFloat: (float)value;

numberWithInt:

+ (NSNumber*) numberWithInt: (int)value;

numberWithLong:

+ (NSNumber*) numberWithLong: (long int)value;

numberWithLongLong:

+ (NSNumber*) numberWithLongLong: (long long int)value;

numberWithShort:

+ (NSNumber*) numberWithShort: (short int)value;

numberWithUnsignedChar:

+ (NSNumber*) numberWithUnsignedChar: (unsigned char)value;

numberWithUnsignedInt:

+ (NSNumber*) numberWithUnsignedInt: (unsigned int)value;

numberWithUnsignedLong:

+ (NSNumber*) numberWithUnsignedLong: (unsigned long int)value;

numberWithUnsignedLongLong:

+ (NSNumber*) numberWithUnsignedLongLong: (unsigned long long int)value;

numberWithUnsignedShort:

+ (NSNumber*) numberWithUnsignedShort: (unsigned short int)value;


Instances Methods

boolValue

- (BOOL) boolValue;

charValue

- (char) charValue;

compare:

- (NSComparisonResult) compare: (NSNumber*)aNumber;

decimalValue

- (NSDecimal) decimalValue;

description

- (NSString*) description;
Invokes descriptionWithLocale: using nil locale.

descriptionWithLocale:

- (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

doubleValue

- (double) doubleValue;

floatValue

- (float) floatValue;

initWithBool:

- (id) initWithBool: (BOOL)value;

initWithChar:

- (id) initWithChar: (char)value;

initWithDouble:

- (id) initWithDouble: (double)value;

initWithFloat:

- (id) initWithFloat: (float)value;

initWithInt:

- (id) initWithInt: (int)value;

initWithLong:

- (id) initWithLong: (long int)value;

initWithLongLong:

- (id) initWithLongLong: (long long int)value;

initWithShort:

- (id) initWithShort: (short int)value;

initWithUnsignedChar:

- (id) initWithUnsignedChar: (unsigned char)value;

initWithUnsignedInt:

- (id) initWithUnsignedInt: (unsigned int)value;

initWithUnsignedLong:

- (id) initWithUnsignedLong: (unsigned long int)value;

initWithUnsignedLongLong:

- (id) initWithUnsignedLongLong: (unsigned long long int)value;

initWithUnsignedShort:

- (id) initWithUnsignedShort: (unsigned short int)value;

intValue

- (int) intValue;

isEqualToNumber:

- (BOOL) isEqualToNumber: (NSNumber*)aNumber;

longLongValue

- (long long int) longLongValue;

longValue

- (long int) longValue;

shortValue

- (short int) shortValue;

stringValue

- (NSString*) stringValue;
Expivalent to descriptionWithLocale: using a nil locale.

unsignedCharValue

- (unsigned char) unsignedCharValue;

unsignedIntValue

- (unsigned int) unsignedIntValue;

unsignedLongLongValue

- (unsigned long long int) unsignedLongLongValue;

unsignedLongValue

- (unsigned long int) unsignedLongValue;

unsignedShortValue

- (unsigned short int) unsignedShortValue;