Hey I have created a Groovy script that will extract the version numbers of some folder. I would then like to compare the version numbers and select the highest.
I g
String maxVersion(versions) {
versions.max { a, b ->
List verA = a.tokenize('.')
List verB = b.tokenize('.')
def commonIndices = Math.min(verA.size(), verB.size())
for (int i = 0; i < commonIndices; ++i) {
def numA = verA[i].toInteger()
def numB = verB[i].toInteger()
if (numA != numB) {
return numA <=> numB
}
}
verA.size() <=> verB.size()
}
}