Table of Contents

charValue

 
- (char)charValue;
 

Returns the receiver’s value.

Return Value - The receiver’s value as datatyp, converting it as necessary.

ObjC Sourcecode Example

    //** Sample Datatype **
    char myChar = 'w';
 
    //** Initializing NSNumber Object **
    NSNumber *myCharNumber = [[NSNumber alloc]initWithChar:myChar];
 
    //**  To access your value use charValue **
    if ([myCharNumber charValue] == 'w') {
 
        NSLog(@"myCharNumber: %@", myCharNumber);
        NSLog(@"myChar: %c", [myCharNumber charValue]);
 
    }

Output for this example code

2012-07-01 15:41:52.009 NSNumberSample[528:f803] myCharNumber: 119
2012-07-01 15:41:52.010 NSNumberSample[528:f803] myChar: w