How to escape special characters in the key of properties file?

前端 未结 2 808
感动是毒
感动是毒 2021-01-18 01:05

I\'ve got a key = value property in the .properties file:

give names: (1) code = xxx

... but when I tried to get that key, it

相关标签:
2条回答
  • 2021-01-18 01:58

    You could check out: http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load(java.io.Reader)

    For info on how java interprets a properties file. The most relevant part is:

    The key contains all of the characters in the line starting with the first non-white space character and up to, but not including, the first unescaped '=', ':', or white space character other than a line terminator.

    0 讨论(0)
  • 2021-01-18 02:04

    In my case, two leading '\\' working fine for me.

    For example : if your word contains the '$' character (e.g. Rf$RF, you can escape it with two leading '\\'

    0 讨论(0)
提交回复
热议问题