How can I replace alla first letters in every word in a string with upper case.
I found that the regExp /\b[a-zA-Z]/ is the right one for finding first letters in every word, but trying
Code:
var upperStr = str.replace(/\b[a-zA-Z]/g," $&").toUpperCase();
didn't work.


I found this working script (that changes for example borderWidth to border-width), but I can't get it work for my purpose:
Code:
var newString = oldString.replace(/[A-Z]/g,"-$&").toLowerCase();





Some ideas?