7 kyu
Capitalize first letter of a string
1,198 of 1,224donaldsebleung
Description:
Capitalize First Letter of a String
Write a function capitalize()
which capitalizes the first letter (if any) of the given string. For example:
Input | Output |
---|---|
string |
String |
hello World |
Hello World |
i love codewars |
I love codewars |
This sentence is already capitalized |
This sentence is already capitalized |
0123the first character of this sentence is not a letter |
0123the first character of this sentence is not a letter |
JavaScript / CoffeeScript: Extend the String
prototype with a method capitalize()
so you can call it on a string like so: "string".capitalize()
. Learn about inheritance and the prototype chain.
Furthermore, the built-in string methods toUpperCase()
and toLowerCase()
are disabled for this Kata.
Fundamentals
Object-oriented Programming
Regular Expressions
Similar Kata:
Stats:
Created | Feb 15, 2016 |
Published | Feb 15, 2016 |
Warriors Trained | 3527 |
Total Skips | 59 |
Total Code Submissions | 8403 |
Total Times Completed | 1224 |
JavaScript Completions | 1198 |
CoffeeScript Completions | 11 |
RISC-V Completions | 26 |
Total Stars | 54 |
% of votes with a positive feedback rating | 83% of 256 |
Total "Very Satisfied" Votes | 193 |
Total "Somewhat Satisfied" Votes | 41 |
Total "Not Satisfied" Votes | 22 |