Javascript - Make first letter of a string capital



Make first letter as capital in string

function InitCap(str)
        {
        var str = this.toLowerCase();
        var Rx = /\b([a-z']+)\b/gi;
        str = str.replace(Rx, function (w)
        {
            return w.charAt(0).toUpperCase() + w.substring(1);
        }
        );
        return str;
    }

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.