• 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
Preserving camelCase when prefixing a method name?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Preserving camelCase when prefixing a method name?


  • Subject: Preserving camelCase when prefixing a method name?
  • From: Graham Cox <email@hidden>
  • Date: Wed, 14 Oct 2009 01:24:53 +1100

Hi all,

I have a situation where I need to build a new selector name from an existing one, by prepending a new part to the selector. e.g. if I have an object with a property 'fooBar', I want to generate the selector 'setSomeSpecialPrefixFooBar'

The problem I've run into is preserving the camel case of the original selector element correctly, so that 'fooBar' becomes 'FooBar', not 'Foobar' as it becomes when applying -capitalizedString to it.

I think just making the first character uppercase would be sufficient, but I'm not sure how to do that reliably with the unichar data type, so that's my first question. The second is that when generating selectors programmatically like this, are there other pitfalls to consider so that the resulting selector is always predictable? The scheme needs to work with arbitrary properties, just as various parts of KVC and KVO do.

--Graham


_______________________________________________

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: Preserving camelCase when prefixing a method name?
      • From: Jim Correia <email@hidden>
    • Re: Preserving camelCase when prefixing a method name?
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Re: Core Data with OpenGL
  • Next by Date: Re: Should VM shrink to original when releasing huge memory
  • Previous by thread: Re: Safari problem
  • Next by thread: Re: Preserving camelCase when prefixing a method name?
  • Index(es):
    • Date
    • Thread