Posted By

KenCorbettJr on 04/11/12


Tagged

javascript String


Versions (?)

Camelize


 / Published in: JavaScript
 

URL: http://davidwalsh.name/javascript-css

Will take a hyphenated string and make it camel case.

  1. function camelize(str) {
  2. return (str + "").replace(/-\D/g, function(match) {
  3. return match.charAt(1).toUpperCase();
  4. });
  5. }

Report this snippet  

You need to login to post a comment.