Javascript String strReplace(repalcement)

Description

Javascript String strReplace(repalcement)


String.prototype.strReplace=function(repalcement){
  var _this=this/*w w  w .j  a va  2  s  . c o m*/
  var _arr=_this.split('$s')
  var str=''
  var arrLen=_arr.length
  for(var i in _arr){
   if(i!==arrLen&&_arr[i]!==''){
    str+=_arr[i]+repalcement[i]
   }
  }
  return str
}



PreviousNext

Related