Skip to content

Instantly share code, notes, and snippets.

@shaosh
Last active March 17, 2016 23:53
Show Gist options
  • Save shaosh/0e159b9db3dc90b8c719 to your computer and use it in GitHub Desktop.
Save shaosh/0e159b9db3dc90b8c719 to your computer and use it in GitHub Desktop.
Remove dash and capitalize the first letter
var a = document.getElementByTagName('view')
for(var i = 0; i < a.length; i++){
var b = a[i].id;
c = b.split('-');
for(var j = 0; j < c.length; j++){
c[j] = c[j].replace(/^./, c[j][0].toUpperCase());
}
var d = c.join('');
console.log(d)
}
//auction ==> Auction
//backorder-domain-service ==> BackorderDomainService
//bulk-domain ==> BulkDomain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment