|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sssw.rt.expr.AgLike
Used to perform String matching using the specifications of SQL 92. The AgLike class supports the use of '%' and '_ 'as wildcards, where % matches zero or more characters and _ matches exactly one character.
Constructor Summary | |
AgLike()
|
Method Summary | |
static boolean |
evaluate(String test,
String pat)
Tests a String to see if it matches a specified pattern. |
static boolean |
evaluate(String test,
String pat,
char escape)
Tests a String to see if it matches a specified pattern. |
static boolean |
evaluateUsingPrepare(String test,
String pattern)
Tests a String using a prepared pattern as an optimization. |
static String |
prepare(String pat,
char escape)
Takes a String pattern and builds another String that optimizes the test. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public AgLike()
Method Detail |
public static boolean evaluate(String test, String pat, char escape)
test
- the String to be used to test against a patternpat
- the String for the patternescape
- specifies an escape character to use to match against % or _. Otherwise, specify AgLike.NO_ESCAPE
.Returns true if the String matches the pattern. Otherwise it returns false. Note that this methos is overloaded. Used this version to treat % and _ as literals in the comparison.
if (AgLike.evaluate("100%", "100+%", '+')) ...
public static boolean evaluate(String test, String pat)
test
- specifies the String to be used to test against a pattern.pat
- specifies the String for the pattern.Note that this method is overloaded. Use this version if % and _ are always treated as wildcards.
if (AgLike.evaluate("Boston", "Bos%") ...
public static boolean evaluateUsingPrepare(String test, String pattern)
test
- specifies the String to test against a pattern.pattern
- specifies a prepared pattern generated using AgLike.prepare().String pat = AgLike.prepare("Bos%", AgLike.NO_ESCAPE); for (int i=0; i < 10; i++) { if (AgLike.evaluateUsingPrepare(array[i], pat)) ... }
AgLike.prepare( String pat, char escape )
public static String prepare(String pat, char escape)
pat
- specifies the String for the pattern.escape
- specifies an escape character to use when matching against % or _ literally in the comparison. Otherwise, specify AgLike.NO_ESCAPE
.String pat = AgLike.prepare("Bos%", AgLike.NO_ESCAPE); ...
AgLike.evaluateUsingPrepare( String test, String pattern)
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |