Re: Splitting a string and assigning to variables
Re: Splitting a string and assigning to variables
- Subject: Re: Splitting a string and assigning to variables
- From: Thomas Finley <email@hidden>
- Date: Sun, 13 Jul 2003 18:00:55 -0400
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.
_______________________________________________
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.