MCPcopy
hub / github.com/lifei6671/interview-go / replaceBlank

Function replaceBlank

src/q005.go:9–19  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

7)
8
9func replaceBlank(s string) (string, bool) {
10 if len([]rune(s)) > 1000 {
11 return s, false
12 }
13 for _, v := range s {
14 if string(v) != " " && unicode.IsLetter(v) == false {
15 return s, false
16 }
17 }
18 return strings.Replace(s, " ", "%20", -1), true
19}
20
21func main() {
22 s1 := "Hello World"

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected