org.jaxen.function
Class SubstringBeforeFunction
java.lang.Objectorg.jaxen.function.SubstringBeforeFunction
- Function
public class SubstringBeforeFunction
extends java.lang.Object
4.2 string substring-before(string,string)
The substring-before function returns the substring of the first argument
string that precedes the first occurrence of the second argument string
in the first argument string, or the empty string if the
first argument string does not contain the second argument string.
For example, substring-before("1999/04/01","/") returns 1999.
- bob mcwhirter (bob @ werken.com)
Object | call(Context context, List args)- Returns the part of the string-value of the first item in
args
that comes before the string-value of the second item in args;
or the empty string if the second string is not a substring of the first string.
|
static String | evaluate(Object strArg, Object matchArg, Navigator nav)- Returns the part of
strArg that precedes the first occurence
of matchArg; or the empty string if the
strArg does not contain matchArg
|
SubstringBeforeFunction
public SubstringBeforeFunction()
Create a new SubstringBeforeFunction object.
call
public Object call(Context context,
List args)
throws FunctionCallException Returns the part of the string-value of the first item in args
that comes before the string-value of the second item in args;
or the empty string if the second string is not a substring of the first string.
- call in interface Function
context - the context at the point in the
expression when the function is calledargs - a list that contains two items
- a
String containing that
part of the string-value of the first item in args
that comes before the string-value of the second item in args
evaluate
public static String evaluate(Object strArg,
Object matchArg,
Navigator nav) Returns the part of strArg that precedes the first occurence
of matchArg; or the empty string if the
strArg does not contain matchArg
strArg - the string from which the substring is extractedmatchArg - the string that marks the boundary of the substringnav - the Navigator used to calculate the string-values of
the first two arguments
- a
String containing the part of strArg that precedes the first occurence
of matchArg