views:

21

answers:

0

Hi,

I have an NSString somewhat like this:

<some lines (unknown amount)>
Key1:thingIWantToKnow
Key2:otherThing
<more lines (also not known how much)>

All lines end with a newline (\n) character. Sometimes the string behind the Key#: is empty (@"") but I would still like to have it.

I was thinking of something like getting the start point of the Key# part. Moving a few characters to the right till I reached ":". From that point I would take all text till the end. Split the text up by the newline character as delimiter and taking the first object of the array with split parts. I know how to do that, but aren't there better ways?