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.


Variable Index

 o BOTH
Constant denoting characters should be added or removed from both the start and end of the text string.
 o LEADING
Constant denoting that characters should be added or removed from the start of a text string.
 o LOWER_CASE
Constant denoting lower case conversion.
 o 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.
 o 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.
 o TRAILING
Constant denoting that characters should be added or removed from the end of a text string.
 o UPPER_CASE
Constant denoting upper case conversion.

Method Index

 o createFilteredOutString(String, char[])
Return the string after filtering to allow all characters which are not in the specified array of excluded characters.
 o createFilteredString(String, int, boolean, boolean, char[])
Return the string after filtering to allow only specified types of characters.
 o createGroupedString(String, int, char, boolean)
Return the given string padded with spaces to the given minimum length.
 o createPaddedString(String, int)
Return the given string padded with spaces to the given minimum length.
 o createPaddedString(String, int, char)
Return the given string padded with the specified pad character, to the given minimum length.
 o createPaddedString(String, int, char, char)
Return the given string padded with the specified pad character, in the specified direction, to the given minimum length.
 o 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.
 o createRepeatedString(char, int)
Return a string consisting of concatenated copies of the specified character.
 o createRepeatedString(String, int)
Return a string consisting of concatenated copies of the specified string.
 o getDistinctChars(String)
Return the distinct characters which are contained in the string given.
 o getDistinctChars(String, int)
Return the distinct characters which are contained in the string given at ot after the start position.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o toCase(String, int)
Return the string converted as determined by the specified case conversion option.
 o toCase(String, int, Locale)
Return the string converted as determined by the specified case conversion option, for the given Locale.
 o toTitleCase(String)
Return the string converted to title case.
 o toTitleCase(String, Locale)
Return the string converted to title case for the given Locale.

Variables

 o LEADING
 public static final char LEADING
Constant denoting that characters should be added or removed from the start of a text string.

 o TRAILING
 public static final char TRAILING
Constant denoting that characters should be added or removed from the end of a text string.

 o BOTH
 public static final char BOTH
Constant denoting characters should be added or removed from both the start and end of the text string.

 o UPPER_CASE
 public static final int UPPER_CASE
Constant denoting upper case conversion.

 o LOWER_CASE
 public static final int LOWER_CASE
Constant denoting lower case conversion.

 o 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.

 o 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.

Methods

 o getDistinctChars
 public static char[] getDistinctChars(String text)
Return the distinct characters which are contained in the string given.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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
 o 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.
 o 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.
 o 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
 o 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
 o 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.
 o 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.
 o 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
 o 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
 o 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.

 o 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.

 o 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
 o 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