解法一
func replaceSpace(s string) string {
return strings.Replace(s," ","%20",-1)
}
解法二
func replaceSpace(s string) string {
a := ""
for i := 0; i < len(s); i++ {
if s[i] == ' ' {
a += "%20"
} else {
a += string(s[i])
}
}
return a
}