Package com.epam.reportportal.utils
Class BasicUtils
- java.lang.Object
-
- com.epam.reportportal.utils.BasicUtils
-
public class BasicUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcompareSemanticVersions(java.lang.String compared, java.lang.String basic)Compares two semantic versions following SemVer precedence rules.static java.lang.StringtruncateString(java.lang.String string, int limit, java.lang.String truncateReplacement)Truncates string to the specified limit.
-
-
-
Method Detail
-
truncateString
@Nonnull public static java.lang.String truncateString(@Nonnull java.lang.String string, int limit, @Nullable java.lang.String truncateReplacement)Truncates string to the specified limit. If string length exceeds the limit, it will be cut and the truncateReplacement will be appended.- Parameters:
string- string to truncatelimit- maximum allowed lengthtruncateReplacement- string to append if truncation happens, defaults toCommonConstants.DEFAULT_TRUNCATE_REPLACEMENTif null- Returns:
- truncated string if original length exceeds the limit, original string otherwise
-
compareSemanticVersions
public static int compareSemanticVersions(@Nonnull java.lang.String compared, @Nonnull java.lang.String basic)Compares two semantic versions following SemVer precedence rules. Returns a negative integer, zero, or a positive integer if the first argument is less than, equal to, or greater than the second respectively.- Parameters:
compared- value for comparisonbasic- value to compare with- Returns:
- -1 if compared value less than basic, 0 if compared value equals basic, 1 if compared value greater than basic
-
-