|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.rim.device.api.util.StringMatch
Checks for matching of substring patterns in strings.
Behaviour
You can concatenate a number of substring patterns together, attempting to
match against each substring pattern in the conglomerate; separate your
patterns with spaces only.
A string matches if it contains at least one instance of one of the substring patterns. The match is the first instance found in the string.
Note that you can search against a substring pattern that is the empty string.
| Constructor Summary | ||
StringMatch(String pattern)
Constructs a new, case-sensitive StringMatch instance. |
||
StringMatch(String patternToMatch,
boolean caseSensitivity)
Constructs a new StringMatch instance. |
||
StringMatch(String patternToMatch,
boolean caseSensitivity,
boolean spaceDelimitsNewPattern)
Constructs a new StringMatch instance. |
||
| Method Summary | ||
int |
indexOf(String text)
Retrieves position of first match in target string. |
|
int |
indexOf(String text,
int offset)
Retrieves position of first match in section of target string. |
|
int |
numStringsInPattern()
Retrieves number of substring patterns used in matching. |
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public StringMatch(String patternToMatch, boolean caseSensitivity)
This builds a string match object, digesting the provided substring pattern for optimized future use.
pattern - Substring pattern to use in match checking.caseSensitiviy - If true, matching observes case; if false,
disregard case in substring pattern and target string.public StringMatch(String patternToMatch, boolean caseSensitivity, boolean spaceDelimitsNewPattern)
This builds a string match object, digesting the provided substring pattern for optimized future use.
pattern - Substring pattern to use in match checking.caseSensitivity - If true, matching observes case; if false,
disregard case in substring pattern and target string.spaceDelimitsNewPattern - If true, patternToMatch is broken into subpatters using space as a delimiter.
If false, whole patternToMatch string is used as the pattern, including spaces.public StringMatch(String pattern)
This builds a string match object, digesting the provided substring pattern for optimized future use. This object observes case when matching.
pattern - Substring pattern to use in match checking.| Method Detail |
public int indexOf(String text)
text - Target string.public int indexOf(String text, int offset) throws IllegalArgumentException
text - Text containing the section to match against.offset - Position of first character in section to match against.IllegalArgumentException - If offset parameter is not contained in
the target string.public int numStringsInPattern()
|
|||||||||
| 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.