Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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