Posted By

jatkins on 11/06/10


Tagged

words String strings capitalize ucfirst capitalization


Versions (?)

JavaScript ucFirst (capitalize the first letter in a string)


 / Published in: JavaScript
 

Public domain. This will capitalize the first letter of a string, and decapitalize the rest.

  1. function ucFirst(string) {
  2. return string.substring(0, 1).toUpperCase() + string.substring(1).toLowerCase();
  3. }

Report this snippet  

You need to login to post a comment.