|
@@ -108,7 +108,7 @@ func main() {
|
|
|
`Replace` 用于将字符串 `str` 中的前 `n` 个字符串 `old` 替换为字符串 `new`,并返回一个新的字符串,如果 `n = -1` 则替换所有字符串 `old` 为字符串 `new`:
|
|
`Replace` 用于将字符串 `str` 中的前 `n` 个字符串 `old` 替换为字符串 `new`,并返回一个新的字符串,如果 `n = -1` 则替换所有字符串 `old` 为字符串 `new`:
|
|
|
|
|
|
|
|
```go
|
|
```go
|
|
|
-strings.Replace(str, old, new, n) string
|
|
|
|
|
|
|
+strings.Replace(str, old, new string, n int) string
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
## 4.7.5 统计字符串出现次数
|
|
## 4.7.5 统计字符串出现次数
|