【问题标题】:In JESS, is there an equivalent command to Java's String.contains("x")?在 JESS 中,是否有与 Java 的 String.contains("x") 等效的命令?
【发布时间】:2017-05-05 11:42:58
【问题描述】:

正如标题所说。我正在用 JESS 编写一个专家系统,我需要读取用户输入以查看它是否包含“Windows”、“Mac”或“Linux”。

【问题讨论】:

    标签: jess


    【解决方案1】:

    试试这个:

    (bind ?sentence "The quick brown fox")
    (bind ?word "quick")
    (if (str-index ?word ?sentence)
       then 
       (printout t "contained" crlf)
       else
       (printout t "not contained" crlf))
    

    regexp 函数让您可以使用 Java 的 java.util.regexp.Pattern 模式进行更复杂的匹配。

    【讨论】:

    • 非常感谢。这正是我需要知道的!
    猜你喜欢
    • 2011-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-10
    • 2012-04-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多