All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.bulletproof.util.StringUtils

java.lang.Object
   |
   +----com.bulletproof.util.StringUtils

public final class StringUtils
extends Object

Constructor Index

 o StringUtils()

Method Index

 o arraycopy(char[], int, char[], int, int)
Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array.
 o decrypt(String, int)
 o dquote(String)
Returns a string with any single quotes replaced by two single quotes.
 o encrypt(int, String)
 o encrypt(String, int)
 o endsWith(String, String)
Checks whether the first string ends with the second string
 o getChars(String, int, int, char[], int)
Converts this string to a new character array.
 o indexOf(String, String)
Returns the index within this string of the first occurrence of the specified substring.
 o indexOf(String, String, int)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
 o isDigit(char)
 o lastIndexOf(String, String)
Returns the index within this string of the first occurrence of the specified substring.
 o lastIndexOf(String, String, int)
Returns the index within this string of the last occurrence of the specified substring, starting at the specified index.
 o ltrim(String)
Trims leading blanks from a String
 o replace(String, char, char)
Replace character in a string with new character.
 o replace(String, String, String)
Replace characters in a string with other characters.
 o replace(String, String, String, int)
Replace characters in a string with other characters.
 o startsWith(String, String)
Checks whether the first string begins with the second string
 o strip(String)
 o toLowerCase(String)
Converts all of the characters in this String to lower case
 o toUpperCase(String)
Converts all of the characters in this String to upper case
 o trim(String)
Trims trailing blanks from a String

Constructors

 o StringUtils
 public StringUtils()

Methods

 o replace
 public static String replace(String dstring,
                              char searchChar,
                              char replaceChar)
Replace character in a string with new character.

Parameters:
dstring - the string to change.
searchChar - the string to search for.
replaceChar - the string to replace the searchString with.
Returns:
the resulting string value.
 o replace
 public static String replace(String dstring,
                              String searchString,
                              String replaceString)
Replace characters in a string with other characters.

Parameters:
dstring - the string to change.
searchString - the string to search for.
replaceString - the string to replace the searchString with.
Returns:
the resulting string value.
 o replace
 public static String replace(String dstring,
                              String searchString,
                              String replaceString,
                              int occurences)
Replace characters in a string with other characters.

Parameters:
dstring - the string to change.
searchString - the string to search for.
replaceString - the string to replace the searchString with.
occurences - the number of occurences to replace.
Returns:
the resulting string value.
 o arraycopy
 public static void arraycopy(char src[],
                              int src_position,
                              char dst[],
                              int dst_position,
                              int length)
Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array. A subsequence of array components are copied from the source array referenced by src to the destination array referenced by dst. The number of components copied is equal to the length argument. The components at positions srcOffset through srcOffset+length-1 in the source array are copied into positions dstOffset through dstOffset+length-1, respectively, of the destination array.

If the src and dst arguments refer to the same array object, then the copying is performed as if the components at positions srcOffset through srcOffset+length-1 were first copied to a temporary array with length components and then the contents of the temporary array were copied into positions dstOffset through dstOffset+length-1 of the argument array.

If any of the following is true, an ArrayStoreException is thrown and the destination is not modified:

Otherwise, if any of the following is true, an ArrayIndexOutOfBoundsException is thrown and the destination is not modified:

Otherwise, if any actual component of the source array from position srcOffset through srcOffset+length-1 cannot be converted to the component type of the destination array by assignment conversion, an ArrayStoreException is thrown. In this case, let k be the smallest nonnegative integer less than length such that src[srcOffset+k] cannot be converted to the component type of the destination array; when the exception is thrown, source array components from positions srcOffset through srcOffset+k-1 will already have been copied to destination array positions dstOffset through dstOffset+k-1 and no other positions of the destination array will have been modified.

Parameters:
src: - the source array.
srcpos - start position in the source array.
dest - the destination array.
destpos - start position in the destination data.
length - the number of array elements to be copied.
Throws: ArrayIndexOutOfBoundsException
if copying would cause access of data outside array bounds.
Throws: ArrayStoreException
if an element in the src array could not be stored into the dest array because of a type mismatch.
 o dquote
 public static String dquote(String base)
Returns a string with any single quotes replaced by two single quotes.

Parameters:
base - base string.
Returns:
a string with any single quotes replaced by two single quotes.
 o indexOf
 public static int indexOf(String base,
                           String str)
Returns the index within this string of the first occurrence of the specified substring.

Parameters:
base - base string.
str - any string.
Returns:
if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned.
 o indexOf
 public static int indexOf(String base,
                           String str,
                           int fromIndex)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.

Parameters:
base - base string.
str - the substring to search for.
fromIndex - the index to start the search from.
Returns:
If the string argument occurs as a substring within this object at a starting index no smaller than fromIndex, then the index of the first character of the first such substring is returned. If it does not occur as a substring starting at fromIndex or beyond, -1 is returned.
 o lastIndexOf
 public static int lastIndexOf(String base,
                               String str)
Returns the index within this string of the first occurrence of the specified substring.

Parameters:
base - base string.
str - any string.
Returns:
if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned.
 o lastIndexOf
 public static int lastIndexOf(String base,
                               String str,
                               int fromIndex)
Returns the index within this string of the last occurrence of the specified substring, starting at the specified index.

Parameters:
base - base string.
str - the substring to search for.
fromIndex - the index to start the search from.
Returns:
If the string argument occurs as a substring within this object at a starting index no smaller than fromIndex, then the index of the first character of the first such substring is returned. If it does not occur as a substring starting at fromIndex or beyond, -1 is returned.
 o startsWith
 public static boolean startsWith(String base,
                                  String str)
Checks whether the first string begins with the second string

Parameters:
base - base string.
str - any string.
Returns:
if the base string starts with str.
 o endsWith
 public static boolean endsWith(String base,
                                String str)
Checks whether the first string ends with the second string

Parameters:
base - base string.
str - any string.
Returns:
if the base string end with str.
 o getChars
 public static void getChars(String base,
                             int srcBegin,
                             int srcEnd,
                             char dst[],
                             int dstBegin)
Converts this string to a new character array.

Returns:
a newly allocated character array whose length is the length of this string and whose contents are initialized to contain the character sequence represented by this string.
 o encrypt
 public static String encrypt(int DSNType,
                              String eValue)
 o encrypt
 public static String encrypt(String eValue,
                              int offset)
 o decrypt
 public static String decrypt(String eValue,
                              int offset)
 o strip
 public static String strip(String columnName)
 o trim
 public static String trim(String text)
Trims trailing blanks from a String

Parameters:
text - the text to trim
Returns:
the trimmed text.
 o ltrim
 public static String ltrim(String text)
Trims leading blanks from a String

Parameters:
text - the text to trim
Returns:
the trimmed text.
 o toUpperCase
 public static String toUpperCase(String str)
Converts all of the characters in this String to upper case

Parameters:
string - the string to convert
Returns:
the String, converted to uppercase.
 o toLowerCase
 public static String toLowerCase(String str)
Converts all of the characters in this String to lower case

Parameters:
string - the string to convert
Returns:
the String, converted to lowercase.
 o isDigit
 public static boolean isDigit(char ch)

All Packages  Class Hierarchy  This Package  Previous  Next  Index