User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







objective-c:foundation.framework:nsnumber.h:descriptionwithlocale

descriptionWithLocale

 
- (NSString *)descriptionWithLocale:(id)aLocale
 

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

ObjC Sourcecode Example

    //** Sample Datatypes **
    int myInt= 1000000;
    double myDouble = 3.14;
    float myFloat = 1.123456f;
    char myChar = 'w';
 
    //** Initializing NSNumber Objects **
    NSNumber *myIntNumber = [[NSNumber alloc]initWithInt:myInt];
    NSNumber *myDoubleNumber = [[NSNumber alloc]initWithDouble:myDouble];
    NSNumber *myFloatNumber = [[NSNumber alloc]initWithFloat:myFloat];
    NSNumber *myCharNumber = [[NSNumber alloc]initWithChar:myChar];
 
    //Use "nil" if you don’t want the description formatted.
    NSLog(@"myIntNumber(Locale: nil): %@", [myIntNumber descriptionWithLocale:nil]);
    NSLog(@"myFloatNumber(Locale: nil): %@", [myFloatNumber descriptionWithLocale:nil]);
    NSLog(@"myDoubleNumber(Locale: nil): %@", [myDoubleNumber descriptionWithLocale:nil]);
    NSLog(@"myCharNumber(Locale: nil): %@", [myCharNumber descriptionWithLocale:nil]);
 

Output for this example code

2012-07-16 00:12:57.484 NSNumberSample[856:f803] myIntNumber(Locale: nil): 1000000
2012-07-16 00:12:57.503 NSNumberSample[856:f803] myFloatNumber(Locale: nil): 1.123456
2012-07-16 00:12:57.504 NSNumberSample[856:f803] myDoubleNumber(Locale: nil): 3.14
2012-07-16 00:12:57.505 NSNumberSample[856:f803] myCharNumber(Locale: nil): 119

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
objective-c/foundation.framework/nsnumber.h/descriptionwithlocale.txt · Last modified: 2024/02/16 01:12 (external edit)

Impressum Datenschutz