Package ch.bztf.m226blb1.Utils
Class Helper
java.lang.Object
ch.bztf.m226blb1.Utils.Helper
Helper class for the project. Contains some useful methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanequalsIgnoreCase(String value, String other) Compares the givenstringsfor equality while ignoring the case.static StringtoUpperCaseNullable(String value) Converts the givenstringto a upper case string.static StringtrimToSize(String value, @javax.validation.constraints.Min(3L) int size) Trims the given string to the given length, appending...if the string is longer than the givenlength.
-
Method Details
-
trimToSize
public static String trimToSize(String value, @Min(3L) @javax.validation.constraints.Min(3L) int size) Trims the given string to the given length, appending...if the string is longer than the givenlength.- Parameters:
value- the value to be checkedsize- the size of the string (greater than 3)- Returns:
- the trimmed value if it is longer than size, otherwise the original value
-
toUpperCaseNullable
Converts the givenstringto a upper case string.- Parameters:
value- the value to be converted- Returns:
- the upper case string or
nullif the value isnull - Implementation Requirements:
- It can handle
nullvalues
-
equalsIgnoreCase
Compares the givenstringsfor equality while ignoring the case.- Parameters:
value- the first value to be comparedother- the second value to be compared- Returns:
trueif the givenstringsare equal, ignoring the case- See Also:
-
Objects.equal(Object, Object)toUpperCaseNullable(String)
-