-[NSString capitalizedString]
-[NSString capitalizedString]
- Subject: -[NSString capitalizedString]
- From: Andy Lee <email@hidden>
- Date: Mon, 11 Nov 2013 13:27:52 -0800
A friend asked why anyone would want the behavior of capitalizedString. The only thing I could think of was to convert all caps to title case, which seems an odd scenario to provide API support for.
Is there a more common need for this method that I haven't thought of?
--Andy
Begin forwarded message:
> Got bit by this: "and all remaining characters set to their corresponding lowercase values" - why would anyone want that?
>
> - (NSString *)capitalizedString
>
> Description
>
> Returns a capitalized representation of the receiver.
>
>
>
> A “word” is any sequence of characters delimited by spaces, tabs, or line terminators (listed under getLineStart:end:contentsEnd:forRange:). Some common word delimiting punctuation isn’t considered, so this method may not generally produce the desired results for multiword strings.
>
> Case transformations aren’t guaranteed to be symmetrical or to produce strings of the same lengths as the originals. See lowercaseString for an example.
>
> Note
>
> This method performs the canonical (non-localized) mapping. It is suitable for programming operations that require stable results not depending on the user's locale preference. For localized case mapping for strings presented to users, use the capitalizedStringWithLocale: method.
>
> Returns
>
> A string with the first character from each word in the receiver changed to its corresponding uppercase value, and all remaining characters set to their corresponding lowercase values.
_______________________________________________
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