public org.apache.poi.hssf.record.formula.eval.Eval | evaluate(org.apache.poi.hssf.record.formula.eval.Eval[] operands, int srcCellRow, short srcCellCol)
Eval retval = ErrorEval.VALUE_INVALID;
int index = 1;
switch (operands.length) {
default:
break;
case 2:
Eval indexEval = operands[1];
index = evaluateAsInteger(indexEval);
if (index < 0) {
break;
}
case 1:
ValueEval veval = singleOperandEvaluate(operands[0], srcCellRow, srcCellCol);
String str = null;
if (veval instanceof StringEval) {
StringEval stringEval = (StringEval) veval;
str = stringEval.getStringValue();
}
else if (veval instanceof BoolEval) {
BoolEval beval = (BoolEval) veval;
str = beval.getBooleanValue() ? "TRUE" : "FALSE";
}
else if (veval instanceof NumberEval) {
NumberEval neval = (NumberEval) veval;
str = neval.getStringValue();
}
if (null != str) {
int strlen = str.length();
str = str.substring(Math.max(0, strlen-index));
retval = new StringEval(str);
}
}
return retval;
|