Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing a Java Properties file in Objective-C for iPhone

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

like image 998
Emmanuel Avatar asked Sep 06 '11 18:09

Emmanuel


People also ask

How to Set Property in properties file in java?

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.

How to work with properties file in java?

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.


1 Answers

I would take a look at ParseKit http://parsekit.com/. Otherwise you could use RegexKitLite and create some regular expressions.

like image 151
Michael Frederick Avatar answered Oct 06 '22 14:10

Michael Frederick