public class LeftFunction extends Object implements JepFunction
left(string, index|string)
function to Jep. It is used to
cut out the leftmost characters of a string. If the second argument is a
number, the string is cut with String.substring(int, int)
with 0 as
the first argument. If the second argument is a string, the position
of that string is looked up in the first string and is used as an index.
Example:
left('foo:bar', 3) == 'foo' left('foo:bar', ':') == 'foo')If the second variant is used and the second string is not found within the first, the first string is returned unmodified.
Constructor and Description |
---|
LeftFunction() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkNumberOfParameters(int n) |
String |
getFunctionName()
Get the name of this function.
|
int |
getNumberOfParameters() |
void |
run(Stack stack) |
void |
setCurNumberOfParameters(int n) |
public String getFunctionName()
JepFunction
JEP
parser.getFunctionName
in interface JepFunction
JEP.addFunction(String, PostfixMathCommandI)
public int getNumberOfParameters()
getNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public void setCurNumberOfParameters(int n)
setCurNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public boolean checkNumberOfParameters(int n)
checkNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public void run(Stack stack) throws ParseException
run
in interface org.nfunk.jep.function.PostfixMathCommandI
ParseException