Re: NSMutableDictionary and retirieving data from web
Re: NSMutableDictionary and retirieving data from web
- Subject: Re: NSMutableDictionary and retirieving data from web
- From: mmalcolm crawford <email@hidden>
- Date: Mon, 12 Apr 2004 14:43:45 -0700
On Apr 12, 2004, at 2:16 PM, Ibrahim Bulut wrote:
NSString* data2 = [[NSString alloc] initWithContentsOfURL:[[NSURL
alloc] initWithString:theUrl]];
NSMutableArray* myArray = [[NSMutableArray alloc] init];
[myArray addObjectsFromArray:[data2
componentsSeparatedByString:@"\t"]];
Anyone got any ideas to basically fill up an NSMutableDictionary with
keynames from url data?
Either use NSScanner:
<
http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/
Concepts/Scanners.html#//apple_ref/doc/uid/20000147>
or, given myArray above (componentsSeparatedByString:@"\t") create a
dictionary (or set of dictionaries if you have multiple "lines") with:
+ (id)dictionaryWithObjects:(NSArray *)objects forKeys:(NSArray *)keys
or
- (id)initWithObjects:(NSArray *)objects forKeys:(NSArray *)keys
where the keys array is an array of key names in the same order you
find them in the data...
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.