标签:turn 空格 函数 har scribe 剑指offer pen title toc
public class Solution { public String replaceSpace(StringBuffer str) { String str1 = str.toString(); char[] charArray = str1.toCharArray(); StringBuffer sBuffer = new StringBuffer(); for(char c : charArray){ if(c == ‘ ‘){ sBuffer.append("%20"); } else{ sBuffer.append(c); } } String string = sBuffer.toString(); return string; } }
标签:turn 空格 函数 har scribe 剑指offer pen title toc
原文地址:https://www.cnblogs.com/goodtest2018/p/12701406.html