Search code examples
objective-cios4

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


Solution

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