|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.util.StringMatch
public final class StringMatch
Checks for matching of substring patterns in strings. The pattern will match a string only if it is an exact match.
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 all of the patterns. The match is the first instance of any pattern 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. |
||
StringMatch(String patternToMatch,
boolean caseSensitivity,
boolean spaceDelimitsNewPattern,
boolean allMatch)
Constructs a new StringMatch instance. |
||
StringMatch(String[] patterns,
boolean caseSensitivity,
boolean allMatch)
Constructs a new StringMatch instance. |
Method Summary | ||
---|---|---|
int |
getLastMatchedPattern()
Retrieves position of the last matched pattern. |
|
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 |
indexOf(StringBuffer text,
int offset)
Retrieves position of first match in section of target StringBuffer. |
|
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 patternToMatch, boolean caseSensitivity, boolean spaceDelimitsNewPattern, boolean allMatch)
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[] patterns, boolean caseSensitivity, boolean allMatch)
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.allMatch
- If true, all patterns must match for pattern to match.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 indexOf(StringBuffer 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()
public int getLastMatchedPattern()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal