• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSMutableDictionary and retirieving data from web
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >NSMutableDictionary and retirieving data from web (From: Ibrahim Bulut <email@hidden>)

  • Prev by Date: NSMutableDictionary and retirieving data from web
  • Next by Date: Re: Getting started with cocoa
  • Previous by thread: NSMutableDictionary and retirieving data from web
  • Next by thread: Re: NSMutableDictionary and retirieving data from web
  • Index(es):
    • Date
    • Thread