【问题标题】:How to filter by String in Objectify如何在 Objectify 中按字符串过滤
【发布时间】:2015-04-16 20:52:48
【问题描述】:

这是我的问题

String text = "I am here"
resutl = ofy().load().type(M.class).filter("good = "+text).first().now();

由于text 包含空格,我如何将其传递给Objectify?我是否将其放在单引号中?双引号?什么?

【问题讨论】:

    标签: string google-app-engine google-cloud-datastore objectify


    【解决方案1】:

    filter() 方法有两个参数:

    ofy().load().type(M.class).filter("good =", text).first().now();
    

    不需要转义值。

    【讨论】:

      【解决方案2】:

      ofy().load().type(M.class).filter("good",text).first().now()

      不需要“=”。它是默认运算符。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-12-22
        • 1970-01-01
        • 2011-08-14
        • 1970-01-01
        • 1970-01-01
        • 2019-12-30
        相关资源
        最近更新 更多