import javax.script.*;
public class TestScript {
    public static void main(String[] args) throws Exception {
        String str = "(a >= 0 && a <= 5)";
          System.out.println(TestScript.isInclude(str,str));
 
    }
      public static Boolean isInclude(String elValue,String elString){ 
      
      

      boolean eval = false;
      try {
        eval = (boolean) engine.eval(el);
      } catch (ScriptException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      return eval;
    }

}
 
ScriptEngine 对象的eval方法解析逻辑字符串
 

相关文章:

  • 2021-11-21
猜你喜欢
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2021-09-02
  • 2021-04-23
  • 2021-09-05
相关资源
相似解决方案