Parsing text from one array into another array in Objective C -


i created array called nsarray citieslist text file separating each object "," @ end of line. here raw data looks text file.

city:san jose|county:santa clara|pop:945942, city:san francisco|county:san francisco|pop:805235, city:oakland|county:alameda|pop:390724, city:fremont|county:alameda|pop:214089, city:santa rosa|county:sonoma|pop:167815, 

the citieslist array fine (i can see count objects, see data, etc.) want parse out city , pop: in each of array objects. assume create loop run through objects, if wanted create mutable array called citynames populate city names array use kind of loop:

smutablearray *citynames = [nsmutablearray array];     (nsstring *i in citieslist) {         [citynames addobject:[???]];     } 

my question what query should use find city: san francisco objects in array?

you can continue use componentsseparatedbystring divide sections , key/value pairs. or can use nsscanner read through string parsing out key/value pairs. use rangeofstring find "|" , extract range. many options.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -