public class Mid extends NaryFunction
mid("abcdefg",2,3) -> "cde"
Syntax: mid(str,start,len)
Second argument is starting index, with the first character being at index 0.
Third argument is number of characters to return.
Note this differs from Excel's mid function which has 1 as the index of the first character.
start
is greater than the length of the string an EvaluationException is thrown.start
is less than zero an EvaluationException is thrown.len
is less than zero an EvaluationException is thrown.start+len
is greater than the length of the string return all characters from start.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 |
---|
Mid() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
eval(java.lang.Object[] args)
Evaluate the function
|
run
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkNumberOfParameters, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
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