go 字符串替换的小代码

package main

import (
    "fmt"
    "strings"
)

func main() {
    broken := "G# R#cks!"
    replacer := strings.NewReplacer("#", "o")
    fixed := replacer.Replace(broken)
    fmt.Println(fixed)

}


posted @ 2023-06-13 10:40  我是四五六  阅读(21)  评论(0)    收藏  举报