Download 10-week-algorithm-excercise-master/OneQuestionPerDay/LCOF5/replace_space.go from Dorothydu/gitrepo_20: direct link, hf CLI and curl.
- Browser
- Download file 227 Bytes
-
https://huggingface.co/datasets/Dorothydu/gitrepo_20/resolve/main/10-week-algorithm-excercise-master/OneQuestionPerDay/LCOF5/replace_space.go
- Command line
-
hf download hf://datasets/Dorothydu/gitrepo_20/10-week-algorithm-excercise-master/OneQuestionPerDay/LCOF5/replace_space.go
-
curl -L -o replace_space.go https://huggingface.co/datasets/Dorothydu/gitrepo_20/resolve/main/10-week-algorithm-excercise-master/OneQuestionPerDay/LCOF5/replace_space.go
227 Bytes
| package main | |
| import "strings" | |
| func replaceSpace(s string) string { | |
| var sb strings.Builder | |
| for i := 0;i< len(s);i++ { | |
| if s[i] == ' ' { | |
| sb.WriteString("%20") | |
| } else { | |
| sb.WriteByte(s[i]) | |
| } | |
| } | |
| return sb.String() | |
| } | |