I'm trying to wrap my head around on how to return a comma-seperated list of items from an Array of numbers..
What I do is call a SQLite class (manages a lot of background SQLite work)
This query returns a list of ID's and fills them in an array like:
000001
000002
000003
Then in another class I can call the resulting array with appDelegate.receptids
Now what I want to do is grab these ID's and stick them in a NSURL in the following way:
At the %@ the ID's need to go in the format of 000001,000002,000003
What's the best approach to properly format the array of ID's into a comma-seperated list like that and pass it to the variable at the end of the NSURL?
What I do is call a SQLite class (manages a lot of background SQLite work)
Code:
- (NSArray *)receptids {
return [SQLiteAccess selectManyValuesWithSQL:@"select receptid from recepten order by dateadded"];
}
This query returns a list of ID's and fills them in an array like:
000001
000002
000003
Then in another class I can call the resulting array with appDelegate.receptids
Now what I want to do is grab these ID's and stick them in a NSURL in the following way:
Code:
NSURL *jsonURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.blah.com/list.php?var=ids/%@",];
At the %@ the ID's need to go in the format of 000001,000002,000003
What's the best approach to properly format the array of ID's into a comma-seperated list like that and pass it to the variable at the end of the NSURL?