I\'ve found the following code at http://snipplr.com/view/2771
Which is pretty good, almost exactly what I was looking for, but if I use the values @\"1.4.5\", @
so you want to compare 10.5 to 1.4.6 such that 10.5 is viewed as 0.10.5
if this is the case, you need to add "0" array items to the left side of your separated version number
NSComparisonResult compareVersions(NSString* leftVersion, NSString* rightVersion)
{
int i;
// Break version into fields (separated by '.')
NSMutableArray *leftFields = [[NSMutableArray alloc] initWithArray:[leftVersion componentsSeparatedByString:@"."]];
NSMutableArray *rightFields = [[NSMutableArray alloc] initWithArray:[rightVersion componentsSeparatedByString:@"."]];
// Implict "0" in case version doesn't have the same number of '.'
if ([leftFields count] < [rightFields count]) {
while ([leftFields count] != [rightFields count]) {
[leftFields insertObject:@"0" atIndex:0];
}
} else if ([leftFields count] > [rightFields count]) {
while ([leftFields count] != [rightFields count]) {
[rightFields insertObject:@"0" atIndex:0];
}
}