Package org.zkoss.util
Class Utils
java.lang.Object
org.zkoss.util.Utils
Generic utilities.
- Since:
- 3.0.0
- Author:
- tomyeh
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final intcompareVersion(int[] v1, int[] v2) Compares two version.static final intgetSubversion(String version, int portion) Returns a portion of the specified version in an integer, or 0 if no such portion exists.static final int[]parseVersion(String version) Parses the specified version into an array of integer.
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
getSubversion
Returns a portion of the specified version in an integer, or 0 if no such portion exists.For example, getSubversion(0) returns the so-called major version (2 in "2.4.0"), and getSubversion(1) returns the so-called minor version (4 in "2.4.0").
Note: alpha is consider as -500, beta -300, and rc -100. Moreover, beta3 is -497 (= -500 + 3) and rc5 -95 (-100 + 5)
- Parameters:
version- the version. The version is assumed to a series of integer separated by a non-alphanumeric separator.portion- which portion of the version; starting from 0. If you want to retrieve the major version, specify 0.- Since:
- 3.0.0
-
parseVersion
Parses the specified version into an array of integer. For example, parseVersion("3.5.2") will return [3, 5, 2].- Since:
- 3.5.2
-
compareVersion
public static final int compareVersion(int[] v1, int[] v2) Compares two version.- Returns:
- 0 if equals, 1 if the first one is larger, -1 if smaller.
- Since:
- 3.5.2
-