Posted By

code4mac on 11/08/12


Tagged

nsnumber


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

hawk007


compare NSNumber


 / Published in: Objective C
 

A way to quickly compare 2 NSNumber

  1. //numberOne and numberTwo are 2 NSNumber
  2. if (numberOne isEqualToNumber: numberTwo)
  3. {
  4. NSLog(@"numberOne is equal to numberTwo");
  5. }
  6. if ([numberOne intValue] > [numberTwo intValue])
  7. {
  8. NSLog(@"numberOne higher than numberTwo");
  9. }
  10. //intValue could be doubleValue, floatValue, etc

Report this snippet  

You need to login to post a comment.