User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







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

isEqualToNumber

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

Returns a Boolean value that indicates whether the receiver and a given number are equal.

ObjC Sourcecode Example

    NSNumber *myBoolNumberYES = [NSNumber numberWithBool:YES];
    NSNumber *myBoolNumberNO = [NSNumber numberWithBool:NO];
 
    NSNumber *myIntNumber2_a = [NSNumber numberWithInt:2];
    NSNumber *myIntNumber2_b = [NSNumber numberWithFloat:2.0];
 
    if ([myBoolNumberNO isEqualToNumber:myBoolNumberYES]) {
        NSLog(@"NUMBERS WITH BOOL ARE EQUAL!");
    }
    else {
        NSLog(@"NUMBERS WITH BOOL ARE NOT EQUAL!");
    }
 
    if ([myIntNumber2_a isEqualToNumber: myIntNumber2_b]) {
        NSLog(@"NUMBERS WITH INT ARE EQUAL!");
    }
    else {
        NSLog(@"NUMBERS WITH INT ARE NOT EQUAL!");
    }

Output for this example code

2012-05-29 00:03:42.197 NSNumberSample[395:f803] NUMBERS WITH BOOL ARE NOT EQUAL!
2012-05-29 00:03:42.199 NSNumberSample[395:f803] NUMBERS WITH INT ARE EQUAL!

on the occasion of the current invasion of Russia in Ukraine

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

Impressum Datenschutz