
Or you may add that function to the String. Return str.charAt(0).toUpperCase() + str.slice(1) ĬapitalizeFirstLetter(string) // Returns "FreeCodecamp" You should create a function that accepts a string as only argument and returns the concatenation of the first letter capitalized string.charAt(0).toUpperCase() and the remainder of the string string.slice(1). Return the result adding the first letter and the remainder of the string It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company. String.slice(1) // Returns "reeCodecamp" 4. Problem: In a PostgreSQL string, you need to make the first letter of each word uppercase and the rest of the letters lowercase.Example: Our database has a table named student with data in two. You may use slice() method and get the remainder of the string (from the second character, index 1, to the end of the string). A quotation that follows a verb of saying (e.g., writes, says, states, exclaims) and is run in to your text is introduced with a comma and begins with a capital letter. String.charAt(0).toUpperCase() // Returns "F" 3. Capitalize the first letter if the quotation appears after a verb of saying, regardless of the case used in the sourcebut flag any alterations you make.

Since the toUpperCase() capitalize the entire string, we ne. Python has a built-in method named capitalize() to convert the first character of a string into uppercase and change the rest of the characters into lowercase. You may use toUpperCase() method and convert the calling string to upper case. To capitalize only the first letter, use the concept of regular expression along withtoUpperCase().
NOTE: charAt is preferable than using ( bracket notation) as str.charAt(0) returns an empty string ( '') for str = '' instead of undefined in case of ''. You should use the charAt() method, at index 0, to select the first character of the string.
