Wednesday, November 9, 2011

Javascript ucwords

var ucwords = function(str) {
    return (str + '').replace(/^([a-z])|\s+([a-z])/g, function ($1) {
        return $1.toUpperCase();
    });
}

No comments:

Post a Comment