Preserving camelCase when prefixing a method name?
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