Created
July 8, 2014 09:52
-
-
Save david90/fd497a0a7d62dfbbd3ee to your computer and use it in GitHub Desktop.
Compare Version String in iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL) isVersion:(NSString *)thisVersionString higherThan:(NSString *)thatVersionString { | |
// LOWER | |
if ([thisVersionString compare:thatVersionString options:NSNumericSearch] == NSOrderedAscending) { | |
NSLog(@"%@ < %@", thisVersionString, thatVersionString); | |
return NO; | |
} | |
// EQUAL | |
if ([thisVersionString compare:thatVersionString options:NSNumericSearch] == NSOrderedSame) { | |
NSLog(@"%@ == %@", thisVersionString, thatVersionString); | |
return NO; | |
} | |
NSLog(@"%@ > %@", thisVersionString, thatVersionString); | |
// HIGHER | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment