public static String Result(String s) throws ScriptException {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("javascript");
Object d = engine.eval(s);
return String.valueOf(d);
}
java几行代码搞定算术表达式的计算
最新推荐文章于 2024-09-09 08:28:32 发布