com.acsinet_solutions.util.regexp
Class RegexpCharFilter
java.lang.Object
com.acsinet_solutions.util.regexp.RegexpCharFilter
- All Implemented Interfaces:
- CharFilter
public final class RegexpCharFilter
- extends java.lang.Object
- implements CharFilter
A regexp based character filter.
Uses internally a regular expression filter.
This class synchronizes itself to be thread-safe
- Author:
- Santiago Arriaga - santiago.arriaga@acsinet-solutions.com
|
Constructor Summary |
RegexpCharFilter(java.lang.String filteredChars,
boolean trimSpaces)
|
|
Method Summary |
java.lang.String |
filter(java.lang.String str)
Filter the given input string, and return the string filtered. |
static RegexpCharFilter |
getFilter(java.lang.String filteredChars,
boolean trimSpaces)
Create a filter, and wrap checked SyntaxException in a runtime exception. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RegexpCharFilter
public RegexpCharFilter(java.lang.String filteredChars,
boolean trimSpaces)
throws SyntaxException
- Parameters:
filteredChars, - the chars to be filtered, hyphens or commas should
be in the end or escaped with a backslash ( example: \- ).trimSpaces, - convenience flag that trims all spaces. Similar to
( \s ) in the filteredChars argument.
- Throws:
SyntaxException
getFilter
public static RegexpCharFilter getFilter(java.lang.String filteredChars,
boolean trimSpaces)
- Create a filter, and wrap checked SyntaxException in a runtime exception.
filter
public final java.lang.String filter(java.lang.String str)
- Filter the given input string, and return the string filtered.
- Specified by:
filter in interface CharFilter
- Parameters:
str - A not-null String
- Returns:
- A not-null filtered String