feat: add ReplaceByMap

This commit is contained in:
dudaodong committed 2023-05-10 10:03:13 +08:00
1 parent c86a8a479d
commit f5784b0f46
3 files changed
+38

No files matched your search

+14
View File
@@ -525,3 +525,17 @@ func ExampleIndexOffset() {
// -1
// -1
}
func ExampleReplaceByMap() {
str := "ac ab ab ac"
replaces := map[string]string{
"a": "1",
"b": "2",
}
result := ReplaceByMap(str, replaces)
fmt.Println(result)
// Output:
// 1c 12 12 1c
}