Can the key in a Java property include a blank character?

前端 未结 5 1508
陌清茗
陌清茗 2020-12-14 00:09

We are getting properties (that we can not influence) out of a database and want to access them by a key/value mapping. We are facing the problem that one of the property ke

5条回答
  •  星月不相逢
    2020-12-14 00:49

    You can escape every thing in properties file with Java Unicode:

    • \u003d for =
    • \u0020 for whitespace

    For example:

    foo bar = barefoot
    

    must be:

    foo\u0020bar\u0020=\u0020barefoot
    

    So will be:

    key: "foo bar "
    value: " barefoot"
    

提交回复
热议问题