剑指offer 1,输入一个字符串,将字符串的空格替换成%20 function replaceSpace(str){ return str.replace(/\s/g,"%20"); } replaceSpace("we are right") 转载于:https://www.cnblogs.com/yayaxuping/p/7131314.html