How to escape curly braces in my properties file which is fetched using the ResourceBundle API

旧巷老猫 提交于 2019-12-22 05:37:16

问题


In properties file I am having a key=A: {{0}, {1}}, B: {{2}, {3}}. I am expecting a string "A: {0, 1}, B: {1, 2}". The numbers inside the curly braces are parsing. How can I include the character '{' without binding to any value? I also tried by escaping the character like this "//{". Even I couldn't get the expected result. An error java.lang.IllegalArgumentException: can't parse argument number 0, 1 \ occurs.


回答1:


key=A: '{'{0}, {1}'}', B: '{'{2}, {3}'}'



回答2:


just run the properties file through native2ascii tool that comes with the JDK. it will do the work for you. Or better use the JRCEditor



来源:https://stackoverflow.com/questions/4779734/how-to-escape-curly-braces-in-my-properties-file-which-is-fetched-using-the-reso

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!