Class LastIndexOf

  extended by net.sourceforge.jeval.function.string.LastIndexOf
All Implemented Interfaces:

public class LastIndexOf
extends java.lang.Object
implements Function

This class is a function that executes within Evaluator. The function returns the index within the source string of the last occurrence of the substring, starting at the specified index. See the String.lastIndexOf(String, int) method in the JDK for a complete description of how this function works.

Constructor Summary
Method Summary
 java.lang.String execute(Evaluator evaluator, java.lang.String arguments)
          Executes the function for the specified argument.
 java.lang.String getName()
          Returns the name of the function - "lastIndexOf".
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public LastIndexOf()
Method Detail


public java.lang.String getName()
Returns the name of the function - "lastIndexOf".

Specified by:
getName in interface Function
The name of this function class.


public java.lang.String execute(Evaluator evaluator,
                                java.lang.String arguments)
                         throws FunctionException
Executes the function for the specified argument. This method is called internally by Evaluator.

Specified by:
execute in interface Function
evaluator - An instance of Evaluator.
arguments - A string argument that will be converted into two string arguments and one integer argument. The first argument is the source string, the second argument is the substring and the third argument is the index. The string argument(s) HAS to be enclosed in quotes. White space that is not enclosed within quotes will be trimmed. Quote characters in the first and last positions of any string argument (after being trimmed) will be removed also. The quote characters used must be the same as the quote characters used by the current instance of Evaluator. If there are multiple arguments, they must be separated by a comma (",").
Returns The index at where the substring is found. If the substring is not found, then -1 is returned.
FunctionException - Thrown if the argument(s) are not valid for this function.

Copyright (C) 2002-2007 Robert Breidecker.