| com.go.tea.runtime.UtilityContext
All known Subclasses: com.go.tea.runtime.DefaultContext,
UtilityContext | public interface UtilityContext extends Context(Code) | | Extends the basic context to provide generic utility functions that most
templates will need to use for formatting.
author: Brian S O'Neill version: 12 , 9/07/00 |
Method Summary | |
public String | cardinal(Long n) A function that converts an integer to a cardinal value. | public String | cardinal(long n) A function that converts an integer to a cardinal value. | public java.util.Date | currentDate() Returns a Date object with the current date and time. | public boolean | endsWith(String str, String suffix) Tests if the given string ends with the given suffix. | public int[] | find(String str, String search) Finds the indices for each occurrence of the given search string in the
source string. | public int[] | find(String str, String search, int fromIndex) Finds the indices for each occurrence of the given search string in the
source string, starting from the given index. | public int | findFirst(String str, String search) Finds the index of the first occurrence of the given search string in
the source string, or -1 if not found. | public int | findFirst(String str, String search, int fromIndex) Finds the index of the first occurrence of the given search string in
the source string, starting from the given index, or -1 if not found. | public int | findLast(String str, String search) Finds the index of the last occurrence of the given search string in the
source string, or -1 if not found. | public int | findLast(String str, String search, int fromIndex) Finds the index of the last occurrence of the given search string in the
source string, starting from the given index, or -1 if not found. | public String | ordinal(Long n) A function that converts an integer to an ordinal value. | public String | ordinal(long n) A function that converts an integer to an ordinal value. | public String | replace(String source, String pattern, String replacement) Replaces all exact matches of the given pattern in the source string
with the provided replacement.
Parameters: source - the source string Parameters: pattern - the simple string pattern to search for Parameters: replacement - the string to use for replacing matched patterns. | public String | replace(String source, String pattern, String replacement, int fromIndex) Replaces all exact matches of the given pattern in the source string
with the provided replacement, starting from the given index. | public String | replace(String source, java.util.Map patternReplacements) Applies string replacements using the pattern-replacement pairs provided
by the given map (associative array). | public String | replaceFirst(String source, String pattern, String replacement) Replaces the first exact match of the given pattern in the source
string with the provided replacement. | public String | replaceFirst(String source, String pattern, String replacement, int fromIndex) Replaces the first exact match of the given pattern in the source
string with the provided replacement, starting from the given index. | public String | replaceLast(String source, String pattern, String replacement) Replaces the last exact match of the given pattern in the source
string with the provided replacement. | public String | replaceLast(String source, String pattern, String replacement, int fromIndex) Replaces the last exact match of the given pattern in the source
string with the provided replacement, starting from the given index. | public String | shortOrdinal(Long n) A function that converts an integer to a short ordinal value. | public String | shortOrdinal(long n) A function that converts an integer to a short ordinal value. | public boolean | startsWith(String str, String prefix) Tests if the given string starts with the given prefix. | public String | substring(String str, int startIndex) Returns the trailing end of the given string, starting from the given
index. | public String | substring(String str, int startIndex, int endIndex) Returns a sub-portion of the given string for the characters that are at
or after the starting index, and are before the end index. | public String | toLowerCase(String str) Converts all the characters in the given string to lowercase. | public String | toUpperCase(String str) Converts all the characters in the given string to uppercase. | public String | trim(String str) Trims all leading and trailing whitespace characters from the given
string. | public String | trimLeading(String str) Trims all leading whitespace characters from the given string. | public String | trimTrailing(String str) Trims all trailing whitespace characters from the given string. |
cardinal | public String cardinal(Long n)(Code) | | A function that converts an integer to a cardinal value. i.e. one,
two, three etc.
Parameters: n - the number to convert a String containing the cardinal value of the specified number |
cardinal | public String cardinal(long n)(Code) | | A function that converts an integer to a cardinal value. i.e. one,
two, three etc.
Parameters: n - the number to convert a String containing the cardinal value of the specified number |
currentDate | public java.util.Date currentDate()(Code) | | Returns a Date object with the current date and time.
|
endsWith | public boolean endsWith(String str, String suffix)(Code) | | Tests if the given string ends with the given suffix.
Returns true if the given string ends with the given suffix.
Parameters: str - the source string Parameters: suffix - the suffix to test for true if the given string ends with the given suffix |
find | public int[] find(String str, String search)(Code) | | Finds the indices for each occurrence of the given search string in the
source string. Returns an array of indices, which is empty if the
search string wasn't found
Parameters: str - the source string Parameters: search - the string to search for an array of indices, which is empty if the search string wasn't found |
find | public int[] find(String str, String search, int fromIndex)(Code) | | Finds the indices for each occurrence of the given search string in the
source string, starting from the given index.
Parameters: str - the source string Parameters: search - the string to search for Parameters: fromIndex - index to start the find an array of indices, which is empty if the search string wasn't found |
findFirst | public int findFirst(String str, String search)(Code) | | Finds the index of the first occurrence of the given search string in
the source string, or -1 if not found.
Parameters: str - the source string Parameters: search - the string to search for the start index of the found string or -1 if not found |
findFirst | public int findFirst(String str, String search, int fromIndex)(Code) | | Finds the index of the first occurrence of the given search string in
the source string, starting from the given index, or -1 if not found.
Parameters: str - the source string Parameters: search - the string to search for Parameters: fromIndex - index to start the find the start index of the found string or -1 if not found |
findLast | public int findLast(String str, String search)(Code) | | Finds the index of the last occurrence of the given search string in the
source string, or -1 if not found.
Parameters: str - the source string Parameters: search - the string to search for the start index of the found string or -1 if not found |
findLast | public int findLast(String str, String search, int fromIndex)(Code) | | Finds the index of the last occurrence of the given search string in the
source string, starting from the given index, or -1 if not found.
Parameters: str - the source string Parameters: search - the string to search for Parameters: fromIndex - optional index to start the find the start index of the found string or -1 if not found |
ordinal | public String ordinal(Long n)(Code) | | A function that converts an integer to an ordinal value. i.e. first,
second, third etc.
Parameters: n - the number to convert a String containing the ordinal value of the specified number |
ordinal | public String ordinal(long n)(Code) | | A function that converts an integer to an ordinal value. i.e. first,
second, third etc.
Parameters: n - the number to convert a String containing the ordinal value of the specified number |
replace | public String replace(String source, String pattern, String replacement)(Code) | | Replaces all exact matches of the given pattern in the source string
with the provided replacement.
Parameters: source - the source string Parameters: pattern - the simple string pattern to search for Parameters: replacement - the string to use for replacing matched patterns. the string with any replacements applied. |
replace | public String replace(String source, String pattern, String replacement, int fromIndex)(Code) | | Replaces all exact matches of the given pattern in the source string
with the provided replacement, starting from the given index.
Parameters: source - the source string Parameters: pattern - the simple string pattern to search for Parameters: replacement - the string to use for replacing matched patterns. Parameters: fromIndex - index to start the replace the string with any replacements applied. |
replace | public String replace(String source, java.util.Map patternReplacements)(Code) | | Applies string replacements using the pattern-replacement pairs provided
by the given map (associative array). The longest matching pattern is
used for selecting an appropriate replacement.
Parameters: source - the source string Parameters: patternReplacements - pattern-replacement pairs |
replaceFirst | public String replaceFirst(String source, String pattern, String replacement)(Code) | | Replaces the first exact match of the given pattern in the source
string with the provided replacement.
Parameters: source - the source string Parameters: pattern - the simple string pattern to search for Parameters: replacement - the string to use for replacing matched patterns the string with any replacements applied |
replaceFirst | public String replaceFirst(String source, String pattern, String replacement, int fromIndex)(Code) | | Replaces the first exact match of the given pattern in the source
string with the provided replacement, starting from the given index.
Parameters: source - the source string Parameters: pattern - the simple string pattern to search for Parameters: replacement - the string to use for replacing matched patterns Parameters: fromIndex - index to start the replace the string with any replacements applied |
replaceLast | public String replaceLast(String source, String pattern, String replacement)(Code) | | Replaces the last exact match of the given pattern in the source
string with the provided replacement.
Parameters: source - the source string Parameters: pattern - the simple string pattern to search for Parameters: replacement - the string to use for replacing matched patterns the string with any replacements applied |
replaceLast | public String replaceLast(String source, String pattern, String replacement, int fromIndex)(Code) | | Replaces the last exact match of the given pattern in the source
string with the provided replacement, starting from the given index.
Parameters: source - the source string Parameters: pattern - the simple string pattern to search for Parameters: replacement - the string to use for replacing matched patterns Parameters: fromIndex - index to start the replace the string with any replacements applied |
shortOrdinal | public String shortOrdinal(Long n)(Code) | | A function that converts an integer to a short ordinal value.
i.e. 1st, 2nd, 3rd etc.
Parameters: n - the number to convert a String containing the short ordinal value of the specified number |
shortOrdinal | public String shortOrdinal(long n)(Code) | | A function that converts an integer to a short ordinal value.
i.e. 1st, 2nd, 3rd etc.
Parameters: n - the number to convert a String containing the short ordinal value of the specified number |
startsWith | public boolean startsWith(String str, String prefix)(Code) | | Tests if the given string starts with the given prefix.
Returns true if the given string starts with the given prefix.
Parameters: str - the source string Parameters: prefix - the prefix to test for true if the given string starts with the given prefix |
substring | public String substring(String str, int startIndex)(Code) | | Returns the trailing end of the given string, starting from the given
index.
Parameters: str - the source string Parameters: startIndex - the start index, inclusive the specified substring. |
substring | public String substring(String str, int startIndex, int endIndex)(Code) | | Returns a sub-portion of the given string for the characters that are at
or after the starting index, and are before the end index.
Parameters: str - the source string Parameters: startIndex - the start index, inclusive Parameters: endIndex - the ending index, exclusive the specified substring. |
toLowerCase | public String toLowerCase(String str)(Code) | | Converts all the characters in the given string to lowercase.
Parameters: str - the string to convert the string converted to lowercase |
toUpperCase | public String toUpperCase(String str)(Code) | | Converts all the characters in the given string to uppercase.
Parameters: str - the string to convert the string converted to uppercase |
trim | public String trim(String str)(Code) | | Trims all leading and trailing whitespace characters from the given
string.
Parameters: str - the string to trim the trimmed string |
trimLeading | public String trimLeading(String str)(Code) | | Trims all leading whitespace characters from the given string.
Parameters: str - the string to trim the trimmed string |
trimTrailing | public String trimTrailing(String str)(Code) | | Trims all trailing whitespace characters from the given string.
Parameters: str - the string to trim the trimmed string |
|
|