Example #1
0
 public Object getValue(RocScript script, String name, String value) {
   if (name == null) {
     return value;
   }
   String key = name.trim().toLowerCase();
   if ("trim".equals(key)) {
     if (value.indexOf(",") == -1) {
       return StringUtils.trim(value);
     }
   } else if ("rtrim".equals(key)) {
     if (value.indexOf(",") == -1) {
       return StringUtils.rtrim(value);
     }
   } else if ("isnan".equals(key)) {
     if (value.indexOf(",") == -1) {
       return MathUtils.isNan(value);
     }
   } else if ("ischinese".equals(key)) {
     if (value.indexOf(",") == -1) {
       return StringUtils.isChinaLanguage(value);
     }
   } else if ("indexof".equals(key)) {
     if (value.indexOf(",") != -1) {
       String[] split = StringUtils.split(value, ',');
       if (split.length == 2) {
         return split[0].indexOf(split[1]) != -1;
       }
     }
   } else if ("jump".equals(key)) {
     script._sleep = JUMP_TYPE;
   }
   IRocFunction roc = (IRocFunction) _rocFunctions.get(key);
   if (roc != null) {
     String[] args = StringUtils.split(value, ',');
     Object o = roc.call(args);
     if (o != null) {
       return o;
     }
   }
   return name;
 }