Here you can find the source of toCamelCase()
String.prototype.toCamelCase = function() { words = this.split(' ') var upperCased = ''; for (var i = 0; i < words.length; i++) { for (var y = 0; y < words[i].length; y++) { if (y == 0) { upperCased += words[i][y].toUpperCase(); }/*from ww w . java2 s. com*/ else { upperCased += words[i][y]; } } upperCased += ' ';//REFACTOR this to not need the additional space }//adding too many spaces, that's why the lengths don't add up return trim(upperCased); }
String.prototype.toCamelCase = function() { var parts = this.split('-'), rtr = "", part; for (var i = 0; i < parts.length; i++) { part = parts[i]; rtr += (i === 0) ? part.toLowerCase() : part[0].toUpperCase()+part.slice(1).toLowerCase(); return rtr; ...
String.prototype.toCamelCase = function() { return this.replace(/-([a-z])/g, function (m, w) { return w.toUpperCase(); });
String.prototype.toCamelCase = function() { return this.replace(/(^|\s)[a-z]/g, function (x) { return x.toUpperCase() });
String.prototype.toCamelCase = function() { return this.toLowerCase() .replace(/[-_]+/g, ' ') .replace(/[^\w\s]/g, '') .replace(/ (.)/g, function($1) { return $1.toUpperCase(); }) .replace(/ /g, ''); }; ...
String.prototype.toCamelCase = function () { return this.charAt(0).toLowerCase() + this.slice(1); };
String.prototype.toCamelCase = function(){ return this.replace(/(\_[a-z])/g, function($1){return $1.toUpperCase().replace('_','');}); };
String.prototype.toCamelCase = function() { return this .replace(/([\-_\.][a-z])/g, ($1) => { return $1.toUpperCase().replace('-',''); }); };
String.prototype.toCamelCase = function() { var str = this.toLowerCase(); var modified = ''; var mark = false; for (var i = 0; i < str.length; i++) { if (str[i] === '_') { mark = true; continue; if (mark) { if (modified.length > 0) { modified += str[i].toUpperCase(); } else { modified = str[i]; mark = false; } else { modified += str[i]; return modified; };
String.prototype.toCamelCase = function() { return this.replace(/[- ](\w)/g, function(match) { return match[1].toUpperCase(); });