题解
替换空格
http://www.nowcoder.com/questionTerminal/4060ac7e3e404ad1a894ef3e17650423
循环寻找每一个空格的位置,并替换
public String replaceSpace(StringBuffer str) { int index_of_space = str.indexOf(" "); while (index_of_space != -1) { str.replace(index_of_space, index_of_space + 1, "%20"); index_of_space = str.indexOf(" "); } return str.toString(); }