• 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: string convertion: converting getter name to setter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: string convertion: converting getter name to setter
      • From: Phil <email@hidden>
References: 
 >string convertion: converting getter name to setter (From: steph thirion <email@hidden>)
 >Re: string convertion: converting getter name to setter (From: Andrew Merenbach <email@hidden>)
 >Re: string convertion: converting getter name to setter (From: Phil <email@hidden>)

  • Prev by Date: Re: Changing the model behind contoller's back?
  • Next by Date: Re: string convertion: converting getter name to setter
  • Previous by thread: Re: string convertion: converting getter name to setter
  • Next by thread: Re: string convertion: converting getter name to setter
  • Index(es):
    • Date
    • Thread