Class VersionComparatorUtil


  • public class VersionComparatorUtil
    extends Object
    Author:
    Leonid Shalupov This versions comparator is much smarter than StringUtil.compareVersionNumbers E.g: is used for TeamCity plugins and Ruby gems versions
    • Method Detail

      • compare

        public static int compare​(String ver1,
                                  String ver2)
        Compare two version strings. See TeamCity documentation on requirements comparison for formal description. Examples: 1.0rc1 < 1.0release, 1.0 < 1.0.1, 1.1 > 1.02
        Returns:
        0 if ver1 equals ver2, positive value if ver1 > ver2, negative value if ver1 < ver2