Package com.indeed.proctor.common
Class LegacyTaglibFunctions
- java.lang.Object
-
- com.indeed.proctor.common.LegacyTaglibFunctions
-
public class LegacyTaglibFunctions extends java.lang.Objectfunctions to be used within Proctor rules. Rules are null-safe and return non-null on any inputwas:
JSTL Functions copied from org.apache.taglibs.standard.Functions, keep the above license statement to remain legal
-
-
Constructor Summary
Constructors Constructor Description LegacyTaglibFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancontains(java.lang.String input, java.lang.String substring)Tests if an input string contains the specified substring.static booleancontainsIgnoreCase(java.lang.String input, java.lang.String substring)Tests if an input string contains the specified substring in a case insensitive way.static booleanendsWith(java.lang.String input, java.lang.String substring)static intindexOf(java.lang.String input, java.lang.String substring)Returns the index withing a string of the first occurrence of a specified substring.static java.lang.Stringjoin(java.lang.String[] array, java.lang.String separator)Joins all elements of an array into a string.static intlength(java.lang.Object obj)static java.lang.Stringreplace(java.lang.String input, java.lang.String substringBefore, java.lang.String substringAfter)static java.lang.String[]split(java.lang.String input, java.lang.String delimiters)Splits a string into an array of substrings.static booleanstartsWith(java.lang.String input, java.lang.String substring)static java.lang.Stringsubstring(java.lang.String input, int beginIndex, int endIndex)substring("foobarbaz", 3, 6)).isEqualTo("bar")static java.lang.StringsubstringAfter(java.lang.String input, java.lang.String substring)static java.lang.StringsubstringBefore(java.lang.String input, java.lang.String substring)static java.lang.StringtoLowerCase(java.lang.String input)Converts all of the characters of the input string to lower case.static java.lang.StringtoUpperCase(java.lang.String input)Converts all of the characters of the input string to upper case.static java.lang.Stringtrim(java.lang.String input)Removes white spaces from both ends of a string.
-
-
-
Method Detail
-
toUpperCase
public static java.lang.String toUpperCase(@Nullable java.lang.String input)Converts all of the characters of the input string to upper case.
-
toLowerCase
public static java.lang.String toLowerCase(@Nullable java.lang.String input)Converts all of the characters of the input string to lower case.
-
indexOf
public static int indexOf(@Nullable java.lang.String input, @Nullable java.lang.String substring)Returns the index withing a string of the first occurrence of a specified substring.- Returns:
- 0 if any argument is null, else index of first occurence, or -1
-
contains
public static boolean contains(@Nullable java.lang.String input, @Nullable java.lang.String substring)Tests if an input string contains the specified substring.- Returns:
- true if any argument is null, else true if substring contained in input
-
containsIgnoreCase
public static boolean containsIgnoreCase(@Nullable java.lang.String input, @Nullable java.lang.String substring)Tests if an input string contains the specified substring in a case insensitive way.- Returns:
- true if any argument is null, else true if substring contained in input
-
startsWith
public static boolean startsWith(@Nullable java.lang.String input, @Nullable java.lang.String substring)- Returns:
- true if any argument is null, else true if input starts with substring
-
endsWith
public static boolean endsWith(@Nullable java.lang.String input, @Nullable java.lang.String substring)- Returns:
- true if any argument is null, else true if input ends with substring
-
substring
public static java.lang.String substring(@Nullable java.lang.String input, int beginIndex, int endIndex)substring("foobarbaz", 3, 6)).isEqualTo("bar")- Parameters:
beginIndex- inclusiveendIndex- exclusive, negative index means infinite- Returns:
- substring after normalizing arguments, empty string if input is null
-
substringAfter
public static java.lang.String substringAfter(@Nullable java.lang.String input, @Nullable java.lang.String substring)- Parameters:
input- if null, empty string is returnedsubstring- if null, input string is returned- Returns:
- a subset of a string before a specific substring.
-
substringBefore
public static java.lang.String substringBefore(@Nullable java.lang.String input, @Nullable java.lang.String substring)- Parameters:
input- if null, empty string is returnedsubstring- if null, input string is returned- Returns:
- arguments is null a subset of a string following a specific substring.
-
trim
public static java.lang.String trim(@Nullable java.lang.String input)Removes white spaces from both ends of a string.- Returns:
- empty string if input is null, trimmed else
-
replace
public static java.lang.String replace(@Nullable java.lang.String input, @Nullable java.lang.String substringBefore, java.lang.String substringAfter)- Parameters:
substringBefore- if empty, input string is returned unchanged- Returns:
- a string resulting from replacing in an input string all occurrences of a non-empty "before" string into an "after" substring.
-
split
public static java.lang.String[] split(@Nullable java.lang.String input, @Nullable java.lang.String delimiters)Splits a string into an array of substrings.- Parameters:
delimiters- "" if null- Returns:
- [""] when input is null
-
length
public static int length(@Nullable java.lang.Object obj)- Returns:
- the number of items in a collection, or the number of characters in a string.
-
join
public static java.lang.String join(@Nullable java.lang.String[] array, @Nullable java.lang.String separator)Joins all elements of an array into a string.- Returns:
- empty string if input is null
-
-