将空格替换成"%20"
String a=s.replace(" ","%20");//注意replace不是直接在s上做修改,而是返回了一个字符串
StringBuilder
StringBuilder sb=new StringBuilder("1234ac");
sb.append("123");//1234ac123
sb.insert(6,"-");//1234ac-123
int index=sb.indexOf(ac);//index=4
sb.insert(index,kkk);//1234kkkac-123
标签:index,Java,StringBuilder,123,字符串,sb,LeetCode
From: https://www.cnblogs.com/DXD-blog/p/16973671.html