• 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: Splitting a string and assigning to variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Splitting a string and assigning to variables


  • Subject: Re: Splitting a string and assigning to variables
  • From: email@hidden
  • Date: Sun, 13 Jul 2003 15:26:31 -0700

On Sunday, July 13, 2003, at 3:00 PM, Thomas Finley wrote:

On Sunday, July 13, 2003, at 05:39 PM, Matt Diephouse wrote:
I'm just thinking about how I would do this if I was programming in Perl. I don't like having to call an array to get my values when passing them to the Book object. This is what I'd do in Perl:

my ($title, $author, $publisher) = split ", ", $bookInfo;
$newBook->setTitle($title);
$newBook->setAuthor($author);
$newBook->setPublisher($publisher);

This quite obviously isn't Perl, though. I'm still getting used to Objective-C. I just find the use of variables more descriptive than the indices of an array.

Explicit or implicit, no matter which approach you use, you're still saying "the first field is the title, the second field is the author, and the third field is the publisher." The Perl code merely restates the ugliness.

yes, I was amazed to see how powerful and flexible the NSMutableDictionary combined with nested NSMutableArray elements was.
Classes [C++ thinking here] no longer need to have explicit member variables -- everything can just be stuffed into a single dictionary. Makes serialization a lot easier too.

=td=
_______________________________________________
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: 
 >Re: Splitting a string and assigning to variables (From: Thomas Finley <email@hidden>)

  • Prev by Date: Possible use of NSKeyedArchive
  • Next by Date: Re: Splitting a string and assigning to variables
  • Previous by thread: Re: Splitting a string and assigning to variables
  • Next by thread: Re: Splitting a string and assigning to variables
  • Index(es):
    • Date
    • Thread