Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Capitalize names in string

How can I capitalise the first letter of names in a string? What is the best way to do this?

2 Answers

Kit Pierce
Kit Pierce
2,721 Points

Have you by chance looked at the documentation for NSString?

There's a specific method for changing case. Hope this link works. If not, you can just do a search on the page for "cap"

Yes I am able to change something to upper case but I was wondering if there was a way to look for names or cities rather than typing them all out? Thanks

Kit Pierce
Kit Pierce
2,721 Points

Nothing I'm aware off the top of my head without comparing to an existing array. I don't know if a pre-built list of city names exist, but I imagine that there are those sorts of lists to be found.

iOS autocomplete catches many city (and proper nouns in general) names automatically.

Okay. Ill take a look. Thanks