package org.matheclipse.core.reflection.system;
import org.matheclipse.core.eval.exception.Validate;
import org.matheclipse.core.eval.interfaces.AbstractFunctionEvaluator;
import org.matheclipse.core.expression.F;
import org.matheclipse.core.interfaces.IAST;
import org.matheclipse.core.interfaces.IExpr;
import org.matheclipse.core.interfaces.IStringX;
import org.matheclipse.core.interfaces.ISymbol;
public class StringLength extends AbstractFunctionEvaluator {
public StringLength() {
}
@Override
public IExpr evaluate(final IAST ast) {
Validate.checkSize(ast, 2);
if (ast.arg1() instanceof IStringX) {
return F.integer(ast.arg1().toString().length());
}
return null;
}
public void setUp(final ISymbol symbol) {
symbol.setAttributes(ISymbol.LISTABLE);
}
}
Ads help maintain this website.