【问题标题】:Parsing Confilict multiple if else and logical operation text in Android在Android中解析多个if else和逻辑操作文本冲突
【发布时间】:2014-07-03 18:52:03
【问题描述】:

简单,但我无法理解部分。

我有字符串 logictext1="IF (QN_723_0 >= 25 AND QN_723_0

让我们假设QN_723_0 is AgeQN_723_1 is weight

你看我上面的字符串,也很清楚。

if I gave input age 28 and weight exactly 75 then return true output otherwise false..

if I gave input age 45 and weight exactly 75 then gives false output.

if I gave input age 45 and weight exactly 74 then gives true output.

我该怎么做?我的主要问题是如何解析上面的 if else 然后在 java 中的字符串。

【问题讨论】:

  • 特别表示这个权重是固定的 75,75,74 etx..不是
  • 其实我有这个QN_770_0=QN_770_0\10之前的字符串,拆分成功但是我很困惑如何拆分上面的字符串。
  • @dipali ,重量是固定的。如果 75 在权重编辑文本字段中输入,请检查以前的年龄组条件。如果匹配为真,否则为假返回。
  • 年龄组条件QN_723_0 >= 25 AND QN_723_0 <= 30 如果为真。
  • @dipali 首先,他无法解释他的答案。不要评论没有建设性的内容。

标签: java android split hashtable


【解决方案1】:
public boolean GetValue() {
    int QN_723_0_age = 0, QN_723_1_weight = 0;
    if ((QN_723_0_age >= 25 && QN_723_0_age <= 30)) {
                QN_723_1_weight == 75;
        return true;
    } else {
        return false;
    }
}

希望对你有用....

if i gave input age 28 and weight exactly 75 then return true output 

if i gave input age 45 and weight exactly 75 then gives false output.

if i gave input age 45 and weight exactly 74 then gives false output.

【讨论】:

  • 感谢您的回复。但我无法拆分逻辑字符串。IF (QN_723_0 &gt;= 25 AND QN_723_0 &lt;= 30) THEN QN_723_1 = 75 END IF";
  • this的输出完全不依赖于权重;它不符合标准编码约定;这不是问题的正确答案。
猜你喜欢
  • 2013-07-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-24
  • 1970-01-01
  • 2017-06-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多