question: public static int compare ( String ver1 , String ver2 ) { if ( ver1 == null ) { return ( ver2 == null ) ? 0 : - 1 ; } else if ( ver2 == null ) { return 1 ; } ver1 = ver1 . toLowerCase ( ) ; ver2 = ver2 . toLowerCase ( ) ; final List < String > s1 = splitVersionString ( ver1 ) ; final List < String > s2 = splitVersionString ( ver2 ) ; padWithNulls ( s1 , s2 ) ; int res = 0 ; for ( int i = 0 ; i < s1 . size ( ) ; i ++ ) { final String e1 = s1 . get ( i ) ; final String e2 = s2 . get ( i ) ; final VersionTokenType t1 = VersionTokenType . lookup ( e1 ) ; final VersionTokenType t2 = VersionTokenType . lookup ( e2 ) ; if ( ! t1 . equals ( t2 ) ) { res = comparePriorities ( t1 , t2 ) ; } else if ( t1 == VersionTokenType . _WORD ) { res = e1 . compareTo ( e2 ) ; } else if ( t1 == VersionTokenType . _DIGITS ) { res = compareNumbers ( e1 , e2 ) ; } if ( res != 0 ) { return res ; } } return 0 ; }
target:  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