Instance Method

descriptionWithLocale:

Returns a string that represents the contents of the number object for a given locale.

Declaration

- (NSString *)descriptionWithLocale:(id)locale;

Parameters

aLocale

An object containing locale information with which to format the description. Use nil if you don’t want the description formatted.

Return Value

A string that represents the contents of the number object formatted using the locale information in locale.

Discussion

For example, if you have an NSNumber object that has the integer value 522, sending it the descriptionWithLocale: message returns the string “522”.

To obtain the string representation, this method invokes NSString’s initWithFormat:locale: method, supplying the format based on the type the NSNumber object was created with:

Data Type

Format Specification

char

%i

double

%0.16g

float

%0.7g

int

%i

long

%li

long long

%lli

short

%hi

unsigned char

%u

unsigned int

%u

unsigned long

%lu

unsigned long long

%llu

unsigned short

%hu

See Also

Retrieving String Representations

stringValue

The number object's value expressed as a human-readable string.