Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

override store() property in java.util.properties

  Asked By: Kenneth    Date: Feb 22    Category: Java    Views: 2109

i want a solution to the problem stated below.
when i use the store ( ) of java.util.properties what it does is that it copies
the key and values to the file being specified
now if i give say p.store("key1","value1")
this is stored in the file as key1=value1
however if i give p.store("key1",":value1")
this is stored as key1 = /:value1
here p is an object of the class properties of java.util.
now what i want to do is that i should override this property so that when i use
: before value1 then too i get the result as key1 = value1.
can anyone send me the whole code for this.



2 Answers Found

Answer #1    Answered By: Edwin Chavez     Answered On: Feb 22

Store your label information with "\" char for special chars

"\" = this is the java  escape char as you use in \n or \r char.

key1 = \:mylabel

when you fetch your label with key1 you 'll get the value -> :mylabel <-

Answer #2    Answered By: Burk Martin     Answered On: Feb 22

adding \ in front of :value1 is not working.
it's showing an error.

Didn't find what you were looking for? Find more on override store() property in java.util.properties Or get search suggestion and latest updates.