Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Convert underscore strings to camel Case

/**
 * Convert underscore_strings to camelCase (medial capitals).
 *
 * @param {string} $str
 *
 * @return {string}
 */
function snakeToCamel ($str) {
  // Remove underscores, capitalize words, squash, lowercase first.
  return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $str))));
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Convert #underscore #strings #camel #Case
ADD COMMENT
Topic
Name
8+3 =