I have following string;
key = value = 123
I want to split up this string into two strings "key" and "value = 123". What is the best way to do this?
I was thinking of using componentsSeparatedByString by “=” and then combine last two components but for me, "key =" is fixed but right side it can be any value like "value1 = 123, value2 = 123" so I can’t use this approach.
Basically if there is a good way to get key (all characters before first = sign) and after first = sign whatever remained is the value then it would be really helpful.
Use the NSScanner!
String
"key = value1 = 123, value2 = 456"would result inkey = "key"andvalue = "value1 = 123, value2 = 456".