@Test public void testExecute() throws Exception { StrLen strlen = new StrLen(); String s = ""; for(int i = 1; i < 100; ++i) { s += "B"; assertEquals(i, strlen.execute(rhsFuncContext, Symbols.asList(syms, s)).asInteger().getValue()); } }
@Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); return context.getSymbols().createInteger(String.format("%#s", arguments.get(0)).length()); }
StrLen extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); return context.getSymbols().createInteger(String.format("%#s", arguments.get(0)).length()); } }
StrLen extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); return context.getSymbols().createInteger(String.format("%#s", arguments.get(0)).length()); } StrLen(); }
StrLen extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); return context.getSymbols().createInteger(String.format("%#s", arguments.get(0)).length()); } StrLen(); @Override Symbol execute(RhsFunctionContext context, List<Symbol> arguments); }
StrLen extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); return context.getSymbols().createInteger(String.format("%#s", arguments.get(0)).length()); } StrLen(); @Override Symbol execute(RhsFunctionContext context, List<Symbol> arguments);  }