Javascript String insertComma()

Description

Javascript String insertComma()

String.prototype.insertComma = function () {
    var string = this;
    var temporary = "";
    while (string != (temporary = string.replace(/^([+-]?\d+)(\d\d\d)/, "$1,$2"))) {
        string = temporary;/*w  w  w . ja  v  a 2 s .c  o m*/
    }
    return string;
}



PreviousNext

Related