dist_tools

Tools for distributing IDL applications

single page | use frames     summary     class     fields     routine details     file attributes

./

mg_cmp_version.pro

includes main-level program

top source mg_cmp_version

result = mg_cmp_version(version1, version2)

Compares two version numbers for the more updated number. Returns 0 for equal versions, 1 if version1 is later than version2, and -1 if version1 is earlier than version2. Strings such as 'alpha' and 'beta' may be tacked on to the end of a version, but are compared alphabetically.

Return value

-1, 0, or 1

Parameters

version1 in required type=string

first version number

version2 in required type=string

second version number

Examples

For example, 1.2 is later than 1.1.2:

IDL> print, mg_cmp_version('1.2', '1.1.2') 1
And 1.2 is earlier than 1.3:
IDL> print, mg_cmp_version('1.2', '1.3') -1
And 1.2 is equivalent to itself:
IDL> print, mg_cmp_version('1.2', '1.2') 0
Also, try the main-level example program at the end of this file:
IDL> .run mg_cmp_version 1.2 1.1.2 1.1 1.1alpha 1.1beta 1.2 > 0 1 1 1 1 1.1.2 > -1 0 1 1 1 1.1 > -1 -1 0 1 1 1.1alpha > -1 -1 -1 0 -1 1.1beta > -1 -1 -1 1 0

File attributes

Modification date: Mon Nov 28 16:00:43 2011
Lines: 100
Docformat: rst rst