1

my string looks like this :

{
    alert = "albert has sent you message for Tomatos.";
    badge = 144;
    notification_text = "28520303-b666-43c8-bb3b-bd0215084cc3";
    sound = default;
}

i want to separate this string and want to construct NSdictionary as key(string before = ) and value (after =)

is there any way to do this ?

Chintan
  • 2,768
  • 4
  • 27
  • 43
  • The code you have posted has more then one string....It looks like you have posted a dictionary? Please may you post the raw string then i will explain how to do it. Cheers, Sam. – shoughton123 May 03 '12 at 14:34
  • looks like you don't want to separate a string, but parse a JSON. Look at this answer: http://stackoverflow.com/a/5813223/53313 – Kai Huppmann May 03 '12 at 15:07

1 Answers1

0

Usually you use NSScanner to parse this kind of data.
Check out the marked answer for an example.

Community
  • 1
  • 1
unexpectedvalue
  • 6,079
  • 3
  • 38
  • 62