Skip to content

Instantly share code, notes, and snippets.

@sh0seo
Created October 21, 2020 14:50
Show Gist options
  • Save sh0seo/3870521362e8d91d7a3e0d6ec17bfcea to your computer and use it in GitHub Desktop.
Save sh0seo/3870521362e8d91d7a3e0d6ec17bfcea to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"strings"
)
func main() {
data := "São Paulo, Brazil. Wien, Österreich."
fmt.Printf("Before: %s\n", data)
after := strings.Map(normalize, data)
fmt.Printf("After: %s\n", after)
}
func normalize(in rune) rune {
switch in {
case 'ã':
return 'a'
case 'Ö':
return 'O'
}
return in
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment