convert string in camel case javascript code example
Example 1: convert camelcase to sentence case javascript
var text = 'helloThereMister';
var result = text.replace( /([A-Z])/g, " $1" );
var finalResult = result.charAt(0).toUpperCase() + result.slice(1);
console.log(finalResult);
Example 2: Convert string to camel case
def to_camel_case(text):
if text == '':
return text
for i in text:
if i == '-' or i == '_':
text = text.replace(text[text.index(i):text.index(i)+2], text[text.index(i)+1].upper(), 1)
return text