<script type="text/javascript">


String.prototype.format = function () {
    var values = arguments;
    return this.replace(/([^\{])?\{(\d+)\}(?!\})/g, function ($0, prefix, pos) {
				//alert(pos);
		pos = parseInt(pos);
		return (prefix || "") + values[pos];

	});
}


//使用方法 
alert("name:{0}, sex:{1}".format("sss", "''(){'"));
alert("{0}, sex:{1}".format("sss", "''(){'"));


</script>

  

相关文章:

  • 2022-12-23
  • 2022-03-03
  • 2021-11-08
  • 2021-11-05
  • 2022-01-17
猜你喜欢
  • 2022-01-01
  • 2021-11-03
  • 2022-12-23
  • 2021-06-10
  • 2021-06-25
  • 2022-12-23
相关资源
相似解决方案