I'm looking for a way in the iPhone SDK to read in a Properties file (not the XML flavor) for example this one:
# a comment
! a comment
a = a string
b = a string with escape sequences \t \n \r \\ \" \' \ (space) \u0123
c = a string with a continuation line \
continuation line
d.e.f = another string
would result in four key/value pairs.
I can't change this format as it is sent to me by a web service. Can you please direct me?
Thanks, Emmanuel
To set properties in a Java Properties instance you use the setProperty() method. Here is an example of setting a property (key - value pair) in a Java Properties object: properties.
We need to access this property file inside your Java class. We have to use the ResourceBundle class and Have to access using a key. First, we will create the object of the resource bundle and will pass the properties file name to it. Next, we have to use the getString(key) method to call the value.
I would take a look at ParseKit http://parsekit.com/. Otherwise you could use RegexKitLite and create some regular expressions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With