@ThreadSafe public final class DependencyVersionUtil extends Object
A utility class to extract version numbers from file names (or other strings containing version numbers.
| Modifier and Type | Method and Description |
|---|---|
static String |
parsePreVersion(String text)
A utility class to extract the part before version numbers from file
names (or other strings containing version numbers.
|
static DependencyVersion |
parseVersion(String text)
A utility class to extract version numbers from file names (or other
strings containing version numbers.
|
static DependencyVersion |
parseVersion(String text,
boolean firstMatchOnly)
A utility class to extract version numbers from file names (or other
strings containing version numbers.
|
public static DependencyVersion parseVersion(String text)
A utility class to extract version numbers from file names (or other strings containing version numbers.
Example: Give the file name: library-name-1.4.1r2-release.jar This function would return: 1.4.1.r2
text - the text being analyzedpublic static DependencyVersion parseVersion(String text, boolean firstMatchOnly)
A utility class to extract version numbers from file names (or other strings containing version numbers.
Example: Give the file name: library-name-1.4.1r2-release.jar This function would return: 1.4.1.r2
text - the text being analyzedfirstMatchOnly - if false and more then one version
string is found in the given text, null will be returned. Otherwise, the
first version found will be returned.public static String parsePreVersion(String text)
A utility class to extract the part before version numbers from file names (or other strings containing version numbers. In most cases, this part represents a more accurate name than the full file name.
Example: Give the file name: library-name-1.4.1r2-release.jar This function would return: library-name
text - the text being analyzedCopyright © 2012–2020 OWASP. All rights reserved.