|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensubsystems.core.util.StringUtils
public final class StringUtils
Utility methods for String manipulation.
| Field Summary | |
|---|---|
static int |
CASE_ORIGINAL
Keep the original case of the string; |
static int |
CASE_TOLOWER
Convert the string to lower case. |
static int |
CASE_TOUPPER
Convert the string to upper case. |
static java.lang.String |
COMMA_STRING
Constant for assigning |
static java.lang.String |
EMPTY_STRING
Constant for assigning |
| Method Summary | |
|---|---|
static java.lang.String |
concat(java.lang.String[] strings,
java.lang.String separator,
java.lang.String quote)
Concat all the specified strings to a single one |
static boolean |
contains(java.util.Collection container,
java.lang.String strSearch)
Test if given string contains any element in the container. |
static boolean |
containsInSeparatedString(java.lang.String strSearchIn,
java.lang.String strSearchFor,
java.lang.String strSeparator)
Method return boolean result if particular substring is contained within the list of substrings separated by a separator. |
static int |
count(java.lang.String text,
char lookup)
Count number of occurences of lookup in text. |
static boolean |
isContained(java.util.Collection container,
java.lang.String strSearch)
Test if any element in the container contains given string. |
static java.lang.String |
limitStringLength(int limitLength,
java.lang.String strValue)
Method to limit String length for display and add '...' to the end |
static java.lang.String |
parseCollectionToString(java.util.Collection colObjects,
java.lang.String strDel)
Parse collection of objects to String by calling toString on each element. |
static double |
parseFraction(java.lang.String textToParse,
double defaultValue,
boolean bIgnoreRest)
Parse textual representation of fraction to a floating point number |
static java.lang.String |
parseIntArrayToString(int[] arrParse,
java.lang.String strDel)
Parse array of integers to String. |
static java.lang.String[] |
parseQuotedStringToStringArray(java.lang.String strParse,
java.lang.String strDel,
boolean bAllowSingleQuote,
boolean bAllowDoubleQuote)
Parse String to array of Strings while treating quoted values as single element. |
static java.util.Collection |
parseStringToCollection(java.lang.String strParse,
java.lang.String strDel,
boolean bTrim,
int iConvertCase,
java.util.Collection container)
Parse String to ANY collection you specify and trim each item. |
static int[] |
parseStringToIntArray(java.lang.String strParse,
java.lang.String strDel)
Parse String to array of integers. |
static java.lang.Integer[] |
parseStringToIntegerArray(java.lang.String strParse,
java.lang.String strDel)
Parse String to array of Integers. |
static java.util.List |
parseStringToList(java.lang.String strParse,
java.lang.String strDel)
Parse String to List. |
static java.lang.String[] |
parseStringToStringArray(java.lang.String strParse,
java.lang.String strDel)
Parse String to array of Strings. |
static java.lang.String |
removeComma(java.lang.String strToRemoveFrom)
Method to remove comma from start and from end of the string for examples to use it as parameter to SQL IN operator |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String EMPTY_STRING
public static final java.lang.String COMMA_STRING
public static final int CASE_ORIGINAL
public static final int CASE_TOUPPER
public static final int CASE_TOLOWER
| Method Detail |
|---|
public static int count(java.lang.String text,
char lookup)
text - - text to search in for occurences of lookuplookup - - character to count
public static double parseFraction(java.lang.String textToParse,
double defaultValue,
boolean bIgnoreRest)
textToParse - - in the form "any_text whole_part quotient/divisor any_text"defaultValue - - if the test is unparsable, what default value to returnbIgnoreRest - - if true, this will ignore the rest of the string
(any_other_text) after the fraction, if false then
the whole string is considered
public static java.lang.String[] parseQuotedStringToStringArray(java.lang.String strParse,
java.lang.String strDel,
boolean bAllowSingleQuote,
boolean bAllowDoubleQuote)
throws OSSInvalidDataException
strParse - - String to parsestrDel - - String deliminerbAllowSingleQuote - - single qoutes such as ' can be used to group valuebAllowDoubleQuote - - double quote such as " can be used to group value
OSSInvalidDataException - - error during parsing
public static int[] parseStringToIntArray(java.lang.String strParse,
java.lang.String strDel)
throws OSSException
strParse - - String to parsestrDel - - String deliminer
OSSException - - error during parsing
public static java.lang.Integer[] parseStringToIntegerArray(java.lang.String strParse,
java.lang.String strDel)
throws OSSException
strParse - - String to parsestrDel - - String deliminer
OSSException - - error during parsing
public static java.lang.String[] parseStringToStringArray(java.lang.String strParse,
java.lang.String strDel)
strParse - - String to parsestrDel - - String deliminer
public static java.lang.String parseIntArrayToString(int[] arrParse,
java.lang.String strDel)
arrParse - - int array to parsestrDel - - String deliminer
public static java.lang.String parseCollectionToString(java.util.Collection colObjects,
java.lang.String strDel)
colObjects - - collection of data objects to parsestrDel - - String deliminer
public static java.util.List parseStringToList(java.lang.String strParse,
java.lang.String strDel)
strParse - - String to parsestrDel - - String deliminer
public static java.util.Collection parseStringToCollection(java.lang.String strParse,
java.lang.String strDel,
boolean bTrim,
int iConvertCase,
java.util.Collection container)
strParse - - String to parsestrDel - - String deliminercontainer - - if specified then it will be filled with items (it WILL
NOT be emptied first). If this is null, the default
collection will be allocated. This allows you here
to pass list or set so this method is more flexible.bTrim - - should it be trimmed or notiConvertCase - - how to convert the case of the string - one of the
CASE_XXX costants
public static java.lang.String limitStringLength(int limitLength,
java.lang.String strValue)
limitLength - - limit of lengthstrValue - - String to limit
public static java.lang.String removeComma(java.lang.String strToRemoveFrom)
strToRemoveFrom - - String to remove comma from
public static java.lang.String concat(java.lang.String[] strings,
java.lang.String separator,
java.lang.String quote)
strings - - strings to concat, all null and empty ones will be ignoredseparator - - separator to put in between the string elementsquote - - quote string to put around string elements, if null nothing
will be put around them
public static boolean isContained(java.util.Collection container,
java.lang.String strSearch)
container - - container of which elements will be searched to see if
they contains given textstrSearch - - text to search in the elements of specified container
public static boolean contains(java.util.Collection container,
java.lang.String strSearch)
container - - container of which elements will be searched to see if
they are contained within given textstrSearch - - text to search in for the elements of specified container
public static boolean containsInSeparatedString(java.lang.String strSearchIn,
java.lang.String strSearchFor,
java.lang.String strSeparator)
strSearchIn - - string of all substrings separated by separator to
search instrSearchFor - - string that will be search forstrSeparator - - item separator
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||