|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.rim.device.api.util.StringUtilities
Utility methods for manipulating Strings.
| Method Summary | ||
static int |
compareObjectToStringIgnoreCase(Object o1,
Object o2)
Compares the string form of two objects, ignoring case. |
|
static int |
compareToIgnoreCase(String s1,
String s2)
Compare two strings, ignoring case. |
|
static int |
computeHashCode(StringBuffer stringBuffer)
Retrieves hashcode of provided string buffer. |
|
static int |
computeReverseLookupHashCodeBytes(byte[] bytes,
int start,
int length)
Retrieves restricted hashcode for section of a byte array. |
|
static int |
computeReverseLookupHashCodeString(String string)
Retrieves restricted hashcode for string (for use in reverse lookups). |
|
static String |
cStr2String(byte[] b,
int start,
int len)
Converts C/C++ string into a Java String. |
|
static int |
indexOf(String string,
char ch,
int fromIndex,
int toIndex)
Retrieves first occurence of character in section of provided string. |
|
static String |
removeChars(String src,
String remove)
Removes specified characters from a string. |
|
static boolean |
startsWithIgnoreCase(String string,
String prefix)
Determines if target string begins with provided prefix. |
|
static boolean |
startsWithIgnoreCaseAndAccents(String string,
String prefix)
NEW NEW NEW Determine if target string begins with a provided prefix, igoring the case and accents of the characters in the string. |
|
static boolean |
strEqual(String s1,
String s2)
Compares two (possibly null) strings for equality. |
|
static boolean |
strEqualIgnoreCase(String s1,
String s2)
Compares two (possibly null) strings for equality, ignoring their case. |
|
static String[] |
stringToWords(String string)
Extracts word tokens from provided string. |
|
static int |
stringToWords(String stringContainingWords,
int[] indexResults,
int resultOffset)
Parses string into words. |
|
static int |
stringToWords(String string,
String[] wordArray,
int index)
Extracts word tokens from provided string, placing them into provided array. |
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static int compareToIgnoreCase(String s1, String s2)
No attempt is currently made to pay attention to ASCII ordering.
s1 - First string to compare.s2 - Second string to compare.public static int computeHashCode(StringBuffer stringBuffer)
An identical hashcode would be produced for a String instance containing the same data.
stringBuffer - String buffer for which to retrieve a hashcode.public static int computeReverseLookupHashCodeString(String string)
The hash only considers alphas, numbers, and the @ sign,
with all characters being lower case.
string - String for which to retrieve the hashcode.
public static int computeReverseLookupHashCodeBytes(byte[] bytes,
int start,
int length)
The hash only considers alphas, numbers, and the @ sign,
with all characters being lower case.
bytes - Byte array containing section for which to retrieve the
hashcode.start - First element to include in the compuatation.length - Number of bytes to include in the computation.public static int stringToWords(String stringContainingWords, int[] indexResults, int resultOffset) throws ArrayIndexOutOfBoundsException
This method computes the positions of words in a target string. A word is a contiguous block of upper case and lower case characters, with the adjecent characters at either end, if they exist, not being upper or lower case.
If the result array is not large enough to hold the computed indexes a ArrayOfOutOfBounds exception is thrown
stringContainingWords - Target string to parse.indexResults - Array of word positions in the target string.indexOffset - First element of the results array to contain
first word position for the target string.ArrayIndexOutOfBoundsException - If the results array is not large
enough to contain positions of all the words found in the target string.public static boolean startsWithIgnoreCase(String string, String prefix)
string - Target string to check.prefix - Prefix to look for.public static boolean startsWithIgnoreCaseAndAccents(String string, String prefix)
string - The Target string to check.prefix - The prefix to look for.public static String[] stringToWords(String string)
A word is a contiguous block of upper case and lower case characters, with the adjecent characters at either end, if they exist, not being upper or lower case.
string - String to tokenize.public static int stringToWords(String string, String[] wordArray, int index)
A word is a contiguous block of upper case and lower case characters, with the adjecent characters at either end, if they exist, not being alphanumeric.
string - String to tokenize.wordArray - Array to contain the word tokens found in provided
string.index - Position in the word array at which to start adding words
found in provided string.public static boolean strEqualIgnoreCase(String s1, String s2)
No attempt is currently made to pay attention to ASCII ordering. Two null strings are considered equal.
s1 - First string to compare.s2 - Second string to compare.public static boolean strEqual(String s1, String s2)
Two null strings are considered equal.
s1 - First string to compare.s2 - Second string to compare.public static final String cStr2String(byte[] b, int start, int len)
This method strips off the trailing nulls. Use this instead of
String.trim() if you don't want to end up creating two string
objects.
b - Byte array containing C/C++ string data.start - First byte in the C/C++ string.len - Length of the C/C++ string (this may include nulls that this
method will strip.public static int compareObjectToStringIgnoreCase(Object o1, Object o2)
This method invokes Object.toString() on both provided objects, and
then compares the two return values for equality. No attempt is
currently made to pay attention to ASCII ordering. A null object sorts
before a non-null object.
o1 - First object to compare.o2 - Second object to compare.public static int indexOf(String string, char ch, int fromIndex, int toIndex)
string - String containing section search.ch - Character to look for.fromIndex - First element in string to look at. If this value is
less than 0, this method assumes it has the value 0. If this value is
greater than the toIndex parameter, this method assumes it has the same
value as the toIndex parameter.toIndex - Last element in string to look at. If this value is
greater than the length of the string, this method assumes it has the
same value as the length of the string.public static String removeChars(String src, String remove)
src - Source string; may not be null.remove - String containing characters to remove from source string;
may not be null.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.