Created
October 21, 2020 14:50
-
-
Save sh0seo/3870521362e8d91d7a3e0d6ec17bfcea to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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