net.rim.device.api.util
Class StringPattern

java.lang.Object
  extended by net.rim.device.api.util.StringPattern

public abstract class StringPattern
extends Object

Provide a standard mechanism for defining pattern searches within Strings.

Since:
BlackBerry API 4.0.0

Nested Class Summary
static class StringPattern.Match
          Holds the results of a successful match examination within a string-pattern.
 
Constructor Summary
StringPattern()
          Creates a new StringPattern object.
 
Method Summary
 boolean findMatch(AbstractString str, int beginIndex, int curIndex, int maxIndex, StringPattern.Match match)
          Find sub-string (within sub-string) at cursor position that matches pattern stored in this string-pattern.
abstract  boolean findMatch(AbstractString str, int beginIndex, int maxIndex, StringPattern.Match match)
          Find next sub-string (within sub-string) that matches pattern stored in this string-pattern.
 boolean findMatch(AbstractString str, int beginIndex, StringPattern.Match match)
          Find next sub-string that matches pattern stored in this string-pattern.
protected static boolean isWhitespace(char c)
          Determines if the supplied character should be considered white space.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

StringPattern

public StringPattern()
Creates a new StringPattern object.

Since:
BlackBerry API 4.0.0


Method Detail

findMatch

public boolean findMatch(AbstractString str,
                         int beginIndex,
                         StringPattern.Match match)
Find next sub-string that matches pattern stored in this string-pattern.

This method looks for a sub-string match between your beginning index position and the last character of the provided string. If str is null, this method returns false.

Parameters:
str - String to search.
beginIndex - First character in string to examine.
match - Match object to contain the complete match information.
Returns:
True if match was found; otherwise, false.
Since:
BlackBerry API 4.0.0

findMatch

public abstract boolean findMatch(AbstractString str,
                                  int beginIndex,
                                  int maxIndex,
                                  StringPattern.Match match)
Find next sub-string (within sub-string) that matches pattern stored in this string-pattern.

This method looks for a sub-string match between your "boundary" index positions within the provided string. If str is null, this method returns false.

Parameters:
str - String to search.
beginIndex - First character in string to examine.
maxIndex - Last character in string to examine.
match - Match object to contain the complete match information.
Returns:
True if match was found; otherwise, false.
Since:
BlackBerry API 4.0.0

findMatch

public boolean findMatch(AbstractString str,
                         int beginIndex,
                         int curIndex,
                         int maxIndex,
                         StringPattern.Match match)
Find sub-string (within sub-string) at cursor position that matches pattern stored in this string-pattern.

This method looks for a sub-string match containing the cursor position between your "boundary" index positions within the provided string. If str is null, this method returns false. This method should be implemented by an extending class. In the absence of an overriding implementation, false is returned.

Parameters:
str - String to search.
beginIndex - First character in string to examine.
curIndex - Cursor position in string to examine.
maxIndex - Last character in string to examine.
match - Match object to contain the complete match information.
Returns:
True if match was found; otherwise, false.
Since:
BlackBerry API 4.1.0

isWhitespace

protected static final boolean isWhitespace(char c)
Determines if the supplied character should be considered white space.

This method considers as white space characters: newlines, carriage returns, tabs, non-breaking spaces, zero-width spaces, CJK spaces, and spaces.

Sub-classes may override this method to provide a wider (or more restricted) class of white-space characters.

Parameters:
c - Character to test.
Returns:
True if provided character is considered whitespace; otherwise false.
Since:
BlackBerry API 4.0.0





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