Created
January 11, 2025 21:52
-
-
Save tenox7/4a68c3aeeca26039e65abb96ee23817c to your computer and use it in GitHub Desktop.
Replace all characters with something
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func replaceChars(str, repl, with string) string { | |
var oldnew []string | |
for _, char := range repl { | |
oldnew = append(oldnew, string(char), with) | |
} | |
return strings.NewReplacer(oldnew...).Replace(str) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment