org.jaxen.function

Class SubstringAfterFunction

public class SubstringAfterFunction extends Object implements Function

4.2 string substring-after(string,string)

The substring-after function returns the substring of the first argument string that follows 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-after("1999/04/01","/") returns 04/01, and substring-after("1999/04/01","19") returns 99/04/01.

Author: bob mcwhirter (bob @ werken.com)

See Also: Section 4.2 of the XPath Specification

Constructor Summary
SubstringAfterFunction()
Create a new SubstringAfterFunction object.
Method Summary
Objectcall(Context context, List args)
Returns the part of the string-value of the first item in args that follows 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 Stringevaluate(Object strArg, Object matchArg, Navigator nav)
Returns the part of strArg that follows the first occurence of matchArg; or the empty string if the strArg does not contain matchArg

Constructor Detail

SubstringAfterFunction

public SubstringAfterFunction()
Create a new SubstringAfterFunction object.

Method Detail

call

public Object call(Context context, List args)
Returns the part of the string-value of the first item in args that follows 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.

Parameters: context the context at the point in the expression when the function is called args a list that contains two items

Returns: 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

Throws: FunctionCallException if args does not have length two

evaluate

public static String evaluate(Object strArg, Object matchArg, Navigator nav)
Returns the part of strArg that follows the first occurence of matchArg; or the empty string if the strArg does not contain matchArg

Parameters: strArg the string from which the substring is extracted matchArg the string that marks the boundary of the substring nav the Navigator used to calculate the string-values of the first two arguments

Returns: a String containing the part of strArg that precedes the first occurence of matchArg