Re: string convertion: converting getter name to setter
Re: string convertion: converting getter name to setter
- Subject: Re: string convertion: converting getter name to setter
- From: Steve Weller <email@hidden>
- Date: Thu, 04 Sep 2008 18:53:13 -0700
On Sep 4, 2008, at 6:37 PM, Phil wrote:
On Fri, Sep 5, 2008 at 1:27 PM, Andrew Merenbach
<email@hidden> wrote:
SEL getterSel = @selector(balloonColor);
NSString *getterName = NSStringFromSelector(getterSel);
NSString *setterName = [@"set" stringByAppendingString:getterName];
SEL setterSel = NSSelectorFromString(setterName);
Selector's are case-sensitive, so you'll have to do...
setterName = [@"set stringByAppendingString:[getterName
capitalizedString]];
Phil
From memory I think that does not work: capitalizedString also
decapitalizes all but the first character, so capitalizedString will
become setCapitalizedstring instead of setCapitalizedString.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Steve Weller email@hidden
Technical Writing, Editing, Developer Guides, and a little Cocoa
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden