add keywords utility example
This commit is contained in:
15
example/stringx/replace/replace.go
Normal file
15
example/stringx/replace/replace.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/tal-tech/go-zero/core/stringx"
|
||||
)
|
||||
|
||||
func main() {
|
||||
replacer := stringx.NewReplacer(map[string]string{
|
||||
"PHP": "PPT",
|
||||
"世界上": "吹牛",
|
||||
})
|
||||
fmt.Println(replacer.Replace("PHP是世界上最好的语言!"))
|
||||
}
|
||||
Reference in New Issue
Block a user