替换空格。字符串中空格替换为%20
*public class Solution{
public static int rePlace(String s){
int length=s.length*3;
Char[] str=new char[length];
for(int i=0;i<length;i++){
if(charAt[i]=' ')
{str[i++]='%';
str[i++]='2';
str[i++]='0';
}else{str[i++]=charAt[i];
}
}int newStr=new char
char(str,0,size)
rertuen newStr;
}
}*
public class Solution{
public static int rePlace(string s){
int length=s.length*3;
char[] str=new char[length];
int size=0;
for(int i=0;i<s.length();i++)
{if(s.charAt(i)==' '){
str[size++]='%';
str[size++]='2';
str[size++]='0';}
else{str[size++]=s.charAt(i);}
}String newStr=new String(str,0,size);
return newStr;
}
}
*public class solution{
public static int rePlace(string s){
int length=s.length*3;
char[] str=new char[length];
int size=0;
for(int i=0;i<s.length();i++)
{if(s.charAt(i)==' '){
str[size++]='%';
str[size++]='2';
str[size++]='0';}
else{str[size++]=s.charAt(i);}
}String newStr=new String(str,0,size);
return newStr;
}
}*