net.rim.device.api.util
Class StringPattern

java.lang.Object
  |
  +--net.rim.device.api.util.StringPattern

public abstract class StringPattern
extends Object

Provide a standard mechanism for defining pattern searches within Strings.

Since:
JDE 4.0.0

Inner Class Summary
static class StringPattern.Match
          Holds the results of a successful match examination within a string-pattern.
 
Constructor Summary
StringPattern()
           
 
Method Summary
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()
Since:
JDE 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.

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:
JDE 4.0.2

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.

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:
JDE 4.0.2

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, 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:
JDE 4.0.2


Copyright 1999-2004 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.