public class Substring extends NaryFunction
substring(str,start,[end])
.
Second argument is starting index,
third argument is optional, if not present return rest of string
if present third argument is the ending index, exclusive.
Note that the indices are zero-based.
start
is greater than the length of the string an EvaluationException is thrown.start
is less than zero an EvaluationException is thrown.end
is less than start an EvaluationException is thrown.end
is greater than the length of the string an EvaluationException is thrown.str
is not a string an EvaluationException is thrown.start
is not a number representing an integer an EvaluationException is thrown.end
is not a number representing an integer an EvaluationException is thrown.String.substring(int, int)
,
Serialized FormcurNumberOfParameters, name, NaN, numberOfParameters
Constructor and Description |
---|
Substring() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkNumberOfParameters(int n)
Checks the number of parameters of the function.
|
java.lang.Object |
eval(java.lang.Object[] args)
Evaluate the function
|
run
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
public boolean checkNumberOfParameters(int n)
PostfixMathCommand
checkNumberOfParameters
in interface PostfixMathCommandI
checkNumberOfParameters
in class PostfixMathCommand
n
- number of parameters function will be called with.public java.lang.Object eval(java.lang.Object[] args) throws EvaluationException
NaryFunction
eval
in class NaryFunction
args
- arguments to the functionEvaluationException
- if the calculation cannot be performedCopyright © 2018 Singular Systems http://www.singularsys.com/jep