javascript 字符串替换
js中怎么把 + 号 换成 %2b
比如
eV85NBoXPa+yma37CRmvqg9PcI7HDD9gRmcHGcDrp+E=
换成:
eV85NBoXPa%2byma37CRmvqg9PcI7HDD9gRmcHGcDrp%2bE=
------解决方案--------------------
var s = 'eV85NBoXPa+yma37CRmvqg9PcI7HDD9gRmcHGcDrp+E=', r;
r = s.replace(/\+/g,'%2b');
alert(s+'\r\n'+r);