java.io.Serializable, java.lang.Cloneable, NodeFilterpublic class StringFilter extends java.lang.Object implements NodeFilter
RegexFilter instead.| Modifier and Type | Field | Description |
|---|---|---|
protected boolean |
mCaseSensitive |
Case sensitive toggle.
|
protected java.util.Locale |
mLocale |
The locale to use converting to uppercase in case insensitive searches.
|
protected java.lang.String |
mPattern |
The string to search for.
|
protected java.lang.String |
mUpperPattern |
The string to really search for (converted to uppercase if necessary).
|
| Constructor | Description |
|---|---|
StringFilter() |
Creates a new instance of StringFilter that accepts all string nodes.
|
StringFilter(java.lang.String pattern) |
Creates a StringFilter that accepts text nodes containing a string.
|
StringFilter(java.lang.String pattern,
boolean sensitive) |
Creates a StringFilter that accepts text nodes containing a string.
|
StringFilter(java.lang.String pattern,
boolean sensitive,
java.util.Locale locale) |
Creates a StringFilter that accepts text nodes containing a string.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
accept(Node node) |
Accept string nodes that contain the string.
|
boolean |
getCaseSensitive() |
Get the case sensitivity.
|
java.util.Locale |
getLocale() |
Get the locale for uppercase conversion.
|
java.lang.String |
getPattern() |
Get the search pattern.
|
void |
setCaseSensitive(boolean sensitive) |
Set case sensitivity on or off.
|
void |
setLocale(java.util.Locale locale) |
Set the locale for uppercase conversion.
|
void |
setPattern(java.lang.String pattern) |
Set the search pattern.
|
protected void |
setUpperPattern() |
Set the real (upper case) comparison string.
|
protected java.lang.String mPattern
protected java.lang.String mUpperPattern
protected boolean mCaseSensitive
true strings are compared with case sensitivity.protected java.util.Locale mLocale
public StringFilter()
public StringFilter(java.lang.String pattern)
Locale.pattern - The pattern to search for.public StringFilter(java.lang.String pattern,
boolean sensitive)
pattern - The pattern to search for.sensitive - If true, comparisons are performed
respecting case, with conversions done using the default
Locale.public StringFilter(java.lang.String pattern,
boolean sensitive,
java.util.Locale locale)
pattern - The pattern to search for.sensitive - If true, comparisons are performed
respecting case.locale - The locale to use when converting to uppercase.
If null, the default Locale is used.protected void setUpperPattern()
public boolean getCaseSensitive()
public void setCaseSensitive(boolean sensitive)
sensitive - If false searches for the
string are case insensitive.public java.util.Locale getLocale()
public void setLocale(java.util.Locale locale)
locale - The locale to set.public java.lang.String getPattern()
public void setPattern(java.lang.String pattern)
pattern - The pattern to set.public boolean accept(Node node)
accept in interface NodeFilternode - The node to check.true if node is a Text node
and contains the pattern string, false otherwise.HTML Parser is an open source library released under LGPL.