Javascript String url()
url()
///*from w w w. ja v a 2 s. c om*/ String.prototype.url = function() { const params = this.match(/:([^\/]+)/ig); let str = this; if (params) { params.forEach((param, i) => { str = str.replace(param, arguments[i]); }); } return '/#' + str; };