很简单啊,就是扫描,找到空格替换成%20
https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/
class Solution {
public String replaceSpace(String s) {
char[] arr = s.toCharArray();
StringBuffer res = new StringBuffer();
for(char i:arr){
if(i == ' '){
res.append('%');
res.append('2');
res.append('0');
}
else res.append(i);
}
return res.toString();
}
}