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

前端 未结 5 1509
陌清茗
陌清茗 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:31

    As it seems the delimiter should be =, not space. Hence - keyValuePair.split("=") should do.

    If you are loading this from a java .properties file, then you can extend java.util.Properties and override this method

    public synchronized void load(InputStream inStream) throws IOException
    

    so that it parses the properties correctly.

提交回复
热议问题