All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.eou.toolkit.util.TextUtils
java.lang.Object
|
+----com.ibm.eou.toolkit.util.TextUtils
- public class TextUtils
- extends Object
This class provides text utility functions.
-
BOTH
- Constant denoting characters should be added or removed from
both the start and end of the text string.
-
LEADING
- Constant denoting that characters should be added or removed
from the start of a text string.
-
LOWER_CASE
- Constant denoting lower case conversion.
-
TITLE_CASE_LENIENT
- Constant representing case conversion where all initial
characters of words are to be converted to title case,
while remaining characters are forced to lower case.
-
TITLE_CASE_STRICT
- Constant representing case conversion where all initial
characters of words are to be converted to title case,
while remaining characters will be left unchanged.
-
TRAILING
- Constant denoting that characters should be added or removed
from the end of a text string.
-
UPPER_CASE
- Constant denoting upper case conversion.
-
createFilteredOutString(String, char[])
- Return the string after filtering to allow all characters
which are not in the specified array of excluded characters.
-
createFilteredString(String, int, boolean, boolean, char[])
- Return the string after filtering to allow only specified
types of characters.
-
createGroupedString(String, int, char, boolean)
- Return the given string padded with spaces to the given
minimum length.
-
createPaddedString(String, int)
- Return the given string padded with spaces to the given
minimum length.
-
createPaddedString(String, int, char)
- Return the given string padded with the specified pad
character, to the given minimum length.
-
createPaddedString(String, int, char, char)
- Return the given string padded with the specified pad
character, in the specified direction, to the given
minimum length.
-
createPaddedString(String, int, char, char, int)
- Return the given string padded with the specified pad
character, in the specified direction, to the given
minimum length.
-
createRepeatedString(char, int)
- Return a string consisting of concatenated copies of the specified character.
-
createRepeatedString(String, int)
- Return a string consisting of concatenated copies of the specified string.
-
getDistinctChars(String)
- Return the distinct characters which are contained in the
string given.
-
getDistinctChars(String, int)
- Return the distinct characters which are contained in the
string given at ot after the start position.
-
indexOf(String, char[])
- Return the position of the first occurance of any of the search
characters in the string, or -1 if none of the search characters
were found in the string.
-
indexOf(String, int, char[])
- Return the position of the first occurance of any of the
search characters at or after the start position, or -1 is
returned if none of the search characters were found after the
start position.
-
indexOfNonMatching(String, char[])
- Return the position of the first character of the string
which is not in the specified array of characters, or -1
if the string is empty or consists entirely of characters
from the specified array.
-
indexOfNonMatching(String, int, char[])
- Return the position of the first character of the string
at or after the start position which is not in the specified
array of characters, or -1 if the string is empty or consists
entirely of characters from the specified array.
-
indexOfNonWhitespace(String)
- Return the position of the first character of the string which
is not whitespace according to Java, or -1 if the string consists
enitrely of whitespace.
-
indexOfNonWhitespace(String, int)
- Return the position of the first character of the string at or
after the start position which is not whitespace according to
Java, or -1 if the string consists enitrely of whitespace.
-
indexOfNonZero(String)
- Return the position of the first character of the string which
is not zero according to Java, or -1 if the string consists
enitrely of zeros.
-
indexOfNonZero(String, int)
- Return the position of the first character of the string at or
after the start position which is not zero according to
Java, or -1 if the string consists enitrely of zeros.
-
lastIndexOf(String, char[])
- Return the position of the last occurance of any of the search
characters in the string, or -1 if none of the search characters
were found in the string.
-
lastIndexOf(String, int, char[])
- Return the position of the last occurance of any of the search
characters at or before the start position, or -1 is returned
if none of the search characters were found before the start position.
-
lastIndexOfNonMatching(String, char[])
- Return the position of the last character of the string
which is not in the specified array of characters, or -1
if the string is empty or consists entirely of characters
from the specified array.
-
lastIndexOfNonMatching(String, int, char[])
- Return the position of the last character of the string
at or before the start position which is not in the specified
array of characters, or -1 if the string is empty or consists
entirely of characters from the specified array.
-
lastIndexOfNonWhitespace(String)
- Return the position of the last character of the string which
is not whitespace according to Java, or -1 if the string consists
enitrely of whitespace.
-
lastIndexOfNonWhitespace(String, int)
- Return the position of the last character of the string at or
before the start position which is not whitespace according to
Java, or -1 if the string consists enitrely of whitespace.
-
lastIndexOfNonZero(String)
- Return the position of the last character of the string which
is not zer according to Java, or -1 if the string consists
enitrely of zero.
-
lastIndexOfNonZero(String, int)
- Return the position of the last character of the string at or
before the start position which is not zero according to
Java, or -1 if the string consists enitrely of zeros.
-
toCase(String, int)
- Return the string converted as determined by the
specified case conversion option.
-
toCase(String, int, Locale)
- Return the string converted as determined by the
specified case conversion option, for the given
Locale.
-
toTitleCase(String)
- Return the string converted to title case.
-
toTitleCase(String, Locale)
- Return the string converted to title case for the given
Locale.
LEADING
public static final char LEADING
- Constant denoting that characters should be added or removed
from the start of a text string.
TRAILING
public static final char TRAILING
- Constant denoting that characters should be added or removed
from the end of a text string.
BOTH
public static final char BOTH
- Constant denoting characters should be added or removed from
both the start and end of the text string.
UPPER_CASE
public static final int UPPER_CASE
- Constant denoting upper case conversion.
LOWER_CASE
public static final int LOWER_CASE
- Constant denoting lower case conversion.
TITLE_CASE_STRICT
public static final int TITLE_CASE_STRICT
- Constant representing case conversion where all initial
characters of words are to be converted to title case,
while remaining characters will be left unchanged.
TITLE_CASE_LENIENT
public static final int TITLE_CASE_LENIENT
- Constant representing case conversion where all initial
characters of words are to be converted to title case,
while remaining characters are forced to lower case.
getDistinctChars
public static char[] getDistinctChars(String text)
- Return the distinct characters which are contained in the
string given.
getDistinctChars
public static char[] getDistinctChars(String text,
int startPosition)
- Return the distinct characters which are contained in the
string given at ot after the start position.
indexOf
public static int indexOf(String searchString,
char searchChars[])
- Return the position of the first occurance of any of the search
characters in the string, or -1 if none of the search characters
were found in the string.
indexOf
public static int indexOf(String searchString,
int startPosition,
char searchChars[])
- Return the position of the first occurance of any of the
search characters at or after the start position, or -1 is
returned if none of the search characters were found after the
start position.
lastIndexOf
public static int lastIndexOf(String searchString,
char searchChars[])
- Return the position of the last occurance of any of the search
characters in the string, or -1 if none of the search characters
were found in the string.
lastIndexOf
public static int lastIndexOf(String searchString,
int startPosition,
char searchChars[])
- Return the position of the last occurance of any of the search
characters at or before the start position, or -1 is returned
if none of the search characters were found before the start position.
indexOfNonMatching
public static int indexOfNonMatching(String searchString,
char searchChars[])
- Return the position of the first character of the string
which is not in the specified array of characters, or -1
if the string is empty or consists entirely of characters
from the specified array.
indexOfNonMatching
public static int indexOfNonMatching(String searchString,
int startPosition,
char searchChars[])
- Return the position of the first character of the string
at or after the start position which is not in the specified
array of characters, or -1 if the string is empty or consists
entirely of characters from the specified array.
lastIndexOfNonMatching
public static int lastIndexOfNonMatching(String searchString,
char searchChars[])
- Return the position of the last character of the string
which is not in the specified array of characters, or -1
if the string is empty or consists entirely of characters
from the specified array.
lastIndexOfNonMatching
public static int lastIndexOfNonMatching(String searchString,
int startPosition,
char searchChars[])
- Return the position of the last character of the string
at or before the start position which is not in the specified
array of characters, or -1 if the string is empty or consists
entirely of characters from the specified array.
indexOfNonWhitespace
public static int indexOfNonWhitespace(String searchString)
- Return the position of the first character of the string which
is not whitespace according to Java, or -1 if the string consists
enitrely of whitespace.
indexOfNonWhitespace
public static int indexOfNonWhitespace(String searchString,
int startPosition)
- Return the position of the first character of the string at or
after the start position which is not whitespace according to
Java, or -1 if the string consists enitrely of whitespace.
lastIndexOfNonWhitespace
public static int lastIndexOfNonWhitespace(String searchString)
- Return the position of the last character of the string which
is not whitespace according to Java, or -1 if the string consists
enitrely of whitespace.
lastIndexOfNonWhitespace
public static int lastIndexOfNonWhitespace(String searchString,
int startPosition)
- Return the position of the last character of the string at or
before the start position which is not whitespace according to
Java, or -1 if the string consists enitrely of whitespace.
indexOfNonZero
public static int indexOfNonZero(String searchString)
- Return the position of the first character of the string which
is not zero according to Java, or -1 if the string consists
enitrely of zeros.
indexOfNonZero
public static int indexOfNonZero(String searchString,
int startPosition)
- Return the position of the first character of the string at or
after the start position which is not zero according to
Java, or -1 if the string consists enitrely of zeros.
lastIndexOfNonZero
public static int lastIndexOfNonZero(String searchString)
- Return the position of the last character of the string which
is not zer according to Java, or -1 if the string consists
enitrely of zero.
lastIndexOfNonZero
public static int lastIndexOfNonZero(String searchString,
int startPosition)
- Return the position of the last character of the string at or
before the start position which is not zero according to
Java, or -1 if the string consists enitrely of zeros.
createGroupedString
public static String createGroupedString(String text,
int groupingSize,
char groupingSeparator,
boolean groupFromRight)
- Return the given string padded with spaces to the given
minimum length. If the string is already sufficiently long,
it is returned unchanged.
/** Return the given string grouped into specified size, separated
by the given character, starting from the gievn direction given.
- Parameters:
- text - the text to group
- groupingSize - the number of characters to group with
- groupingSeparator - the character to use between the groups
- groupFromRight - true if start grouping from the right of
the string
createPaddedString
public static String createPaddedString(String text,
int minimum)
- Return the given string padded with spaces to the given
minimum length. If the string is already sufficiently long,
it is returned unchanged.
- Parameters:
- text - the string to be padded
- minimum - the minimum length to pad the string up to.
createPaddedString
public static String createPaddedString(String text,
int minimum,
char pad)
- Return the given string padded with the specified pad
character, to the given minimum length. If the string is
already sufficiently long, it is returned unchanged.
- Parameters:
- text - the string to be padded
- minimum - the minimum length to pad the string up to.
- pad - the pad character to be added.
createPaddedString
public static String createPaddedString(String text,
int minimum,
char pad,
char direction)
- Return the given string padded with the specified pad
character, in the specified direction, to the given
minimum length. If the string is already sufficiently long,
it is returned unchanged.
- Parameters:
- text - the string to be padded
- minimum - the minimum length to pad the string up to
- pad - the pad character to be added
- direction - the direction to add characters, can be LEADING, TRAILING, or BOTH
- See Also:
- LEADING, TRAILING, BOTH
createPaddedString
public static String createPaddedString(String text,
int minimum,
char pad,
char direction,
int maximum)
- Return the given string padded with the specified pad
character, in the specified direction, to the given
minimum length. If the string is already sufficiently long,
but is not longer than the given maximum length, it is
returned unchanged. If the string is longer than the given
maximum length, it is returned truncated from the specified
direction to that given maximum length.
- Parameters:
- text - the string to be padded or truncated
- minimum - the minimum length to pad the string up to
- pad - the pad character to be added
- direction - the direction to add characters, can be LEADING, TRAILING, or BOTH
- maximum - the length to truncate the string down to
- See Also:
- LEADING, TRAILING, BOTH
createRepeatedString
public static String createRepeatedString(char item,
int count)
- Return a string consisting of concatenated copies of the specified character.
- Parameters:
- item - the character to be copied.
- count - the number of copies to be concatenated.
createRepeatedString
public static String createRepeatedString(String item,
int count)
- Return a string consisting of concatenated copies of the specified string.
- Parameters:
- item - the string to be copied.
- count - the number of copies to be concatenated.
createFilteredString
public static String createFilteredString(String text,
int baseForAllowedDigits,
boolean allowLetters,
boolean allowWhitespace,
char additional[])
- Return the string after filtering to allow only specified
types of characters. All Unicode defined digit characters
and alphabetic digit substitutes, up to the specified base,
are allowed. If the base is specified as zero, digits
are not allowed. If allowLetters is true all Unicode letters
are allowed irrespective of case. If allowWhitespace is true
characters which are whitespace according to Java are allowed.
An array of additional allowed characters can also be
supplied, or null to allow no additional characters.
- Parameters:
- text - the string to be filtered
- baseForAllowedDigits - the numeric base for allowed
digits, or zero if digits are not allowed.
- allowLetters - true if letters are allowed
- allowWhitespace - true if whitespace is allowed
- additional - an array of additional allowed characters, or null
createFilteredOutString
public static String createFilteredOutString(String text,
char excludedChars[])
- Return the string after filtering to allow all characters
which are not in the specified array of excluded characters.
- Parameters:
- text - the string to be filtered
- excludedChars - an array of excluded characters
toTitleCase
public static String toTitleCase(String text)
- Return the string converted to title case. The initial
character of each word is translated to title case,
and the remainder of each word is left unchanged.
toTitleCase
public static String toTitleCase(String text,
Locale locale)
- Return the string converted to title case for the given
Locale. If the locale is null, the current default
Locale is used. The initial character of each word is
converted to title case according to the locale,
and the remainder of each word is left unchanged.
toCase
public static String toCase(String text,
int caseOption)
- Return the string converted as determined by the
specified case conversion option.
- See Also:
- UPPER_CASE, LOWER_CASE, TITLE_CASE_STRICT, TITLE_CASE_LENIENT
toCase
public static String toCase(String text,
int caseOption,
Locale locale)
- Return the string converted as determined by the
specified case conversion option, for the given
Locale. If locale is null, the current default
Locale is used.
- See Also:
- UPPER_CASE, LOWER_CASE, TITLE_CASE_STRICT, TITLE_CASE_LENIENT
All Packages Class Hierarchy This Package Previous Next Index