|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ibisph.util.StrLib
public abstract class StrLib
StrLib is an abstract class with various utility methods for String manipulation and other odd ball methods.
In addition to being abstract each method in the class is static. Access the methods by referencing the class and method name.
Example: StrLib.occurs("This is an example", "example");
In this example the occurs method will be executed using the provided parameters.
| Constructor Summary | |
|---|---|
StrLib()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
buildCSV(java.lang.String[] array)
Builds a comma separated string based on the string array passed in. |
static java.lang.String |
capitalize(java.lang.String s)
Capitalize the first letter of the string. |
static java.lang.String |
capitalizeWordsFirstLetter(java.lang.String sourceString)
Capitalizes the first letter of each word in a String. |
static java.lang.String |
clean(java.lang.String source,
java.lang.String getRidOf)
Cleans out all occurrences of the specified characters within the search String. |
static java.lang.String |
cleanEnd(java.lang.String source,
java.lang.String getRidOf)
Removes all occurrences of the specified characters from the end of the source String. |
static java.lang.String |
cleanStart(java.lang.String source,
java.lang.String getRidOf)
Removes all occurrences of the specified characters from the start of the source String. |
static java.lang.String |
dbQuote(java.lang.String source)
Replaces single quote marks ' with '' and places ' at the start and end of the string. |
static java.lang.String |
getMaxLengthString(java.lang.String[] array)
Returns the String with the greatest length contained within the array. |
static int |
getMaxStringLength(java.lang.String[] array)
Returns the greatest length of a string contained within the array. |
static boolean |
isSomething(java.lang.String source)
This method is used to test for values being not null and non blank. |
static boolean |
isTorYorX(java.lang.String source)
Helper that localizes testing if a string contains True/False, Yes/No, or simply an X. |
static int |
occurs(java.lang.String source,
java.lang.String value)
Counts the occurrences of a String within a String. |
static void |
searchAndReplace(java.lang.StringBuffer source,
java.lang.String search,
java.lang.String replace)
Replaces all occurrences of a String within a StringBuffer with another String with all occurrences of String replaced by a new String. |
static java.lang.String |
searchAndReplace(java.lang.String source,
java.lang.String[][] searchAndReplace)
Returns a new string which is built by searching the source string for all occurrences of each searchAndReplace[x][0] string and replacing that part with the corresponding searchAndReplace[x][1] string. |
static java.lang.String |
searchAndReplace(java.lang.String source,
java.lang.String search,
java.lang.String replace)
Replaces all occurrences of a String within a String with another String. |
static java.lang.String |
trunc(java.lang.String source,
int length)
Truncates a String to a specified length starting from the left most character of the String. |
static java.lang.String |
truncateLeft(java.lang.String source,
int length)
Truncates a String to a specified length starting from the left most character of the String. |
static java.lang.String |
truncateRight(java.lang.String source,
int length)
Truncates a String to a specified length starting from the right most character of the String. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StrLib()
| Method Detail |
|---|
public static int occurs(java.lang.String source,
java.lang.String value)
source - A String.value - String that is the value to count.
public static java.lang.String capitalize(java.lang.String s)
s - java.lang.Stringpublic static java.lang.String capitalizeWordsFirstLetter(java.lang.String sourceString)
sourceString - Text to be capitalized.
public static java.lang.String truncateLeft(java.lang.String source,
int length)
source - Text to be trimmed.length - Amount of the desired String to be returned.
public static java.lang.String trunc(java.lang.String source,
int length)
source - Text to be trimmed.length - Amount of the desired String to be returned.
public static java.lang.String truncateRight(java.lang.String source,
int length)
source - Text to be trimmed.length - Amount of the desired String to be returned.
public static java.lang.String searchAndReplace(java.lang.String source,
java.lang.String search,
java.lang.String replace)
source - Text to be searched and replaced.search - Text searched for.replace - Text used to replace found sub strings with.
public static java.lang.String searchAndReplace(java.lang.String source,
java.lang.String[][] searchAndReplace)
source - Text to be searched and replaced.searchAndReplace - 2-d dimensional String array which has element [0]
containing the String to be searched for, and element [1]
containing replace text.
public static void searchAndReplace(java.lang.StringBuffer source,
java.lang.String search,
java.lang.String replace)
source - StringBuffer which is the String to be searched.search - Searched for text.replace - Value to replace with.
public static java.lang.String clean(java.lang.String source,
java.lang.String getRidOf)
source - Text to be cleaned.getRidOf - Contains character(s) to be removed from the source.
public static java.lang.String cleanStart(java.lang.String source,
java.lang.String getRidOf)
source - Text to be "left" cleaned of characters.getRidOf - Contains character(s) to be removed from the start of
the source string.
public static java.lang.String cleanEnd(java.lang.String source,
java.lang.String getRidOf)
source - Text to be "right" cleaned of characters.getRidOf - Contains character(s) to be removed from the end of
the source string.
public static boolean isTorYorX(java.lang.String source)
source - Text to be interpreted as either true/false, yes/no or X
which means (true).
public static boolean isSomething(java.lang.String source)
source - Text to be tested.
public static java.lang.String dbQuote(java.lang.String source)
source - A String to be operated on.
public static java.lang.String buildCSV(java.lang.String[] array)
array - A String array that contains the elements of the CSV.
public static java.lang.String getMaxLengthString(java.lang.String[] array)
array - A String array that contains the strings to be checked.
public static int getMaxStringLength(java.lang.String[] array)
array - A String array that contains the strings to be checked.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||