var str = "2,5" String.prototype.ToNumber = function () { return Number(this.split(",").join(".")) }; alert(str.ToNumber())