Capitalize Words

Write a method that takes in a string of lowercase letters and spaces, producing a new string that capitalizes the first letter of each word.

You’ll want to use the ‘split’ and ‘join’ methods. Also, the String method  ‘upcase’, which converts a string to all upper case will be helpful.

Provided solution:

screen-shot-2016-09-16-at-4-17-44-pm

My original solution was unnecessarily complicated and didn’t work.  😦

Reminders:

  • When using ‘join’, use the original variable that was defined by ‘split’.
  • There’s no need to split up the words into letters.  Just need to call on the first index of each word and increment to the next word in the sentence.

 

 

 

Advertisements
Capitalize Words

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s