Anonymous Anonymous - 4 months ago
213 0

No description

Javascript

camelize the string

function camelize(str){

		newstr = str.split('-')
		substr = newstr[0]
		//alert(substr)
		for(var i= 1;i <newstr.length;i++){
			firststr = newstr[i].charAt(0).toUpperCase()
			for(var j=1;j<newstr[i].length;j++){
				firststr += newstr[i][j]
			}
			substr += firststr
			firststr =""
		}
		return substr
}
alert(camelize("hello-ashish"))
alert(camelize("my-name-is-ashish"))