Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 657
Achaius Avatar asked Jan 24 '11 07:01

Achaius


2 Answers

key=A: '{'{0}, {1}'}', B: '{'{2}, {3}'}'
like image 138
cherouvim Avatar answered Sep 21 '22 15:09

cherouvim


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

like image 35
Aravind Yarram Avatar answered Sep 21 '22 15:09

Aravind Yarram