Created
October 21, 2020 14:52
-
-
Save sh0seo/076c81114b345c5ed99d16f4bc1bdb04 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" | |
"unicode" | |
"golang.org/x/text/transform" | |
"golang.org/x/text/unicode/norm" | |
) | |
func isMn(r rune) bool { | |
return unicode.Is(unicode.Mn, r) // Mn: nonspacing marks | |
} | |
func main() { | |
t := transform.Chain(norm.NFD, transform.RemoveFunc(isMn), norm.NFC) | |
result, _, _ := transform.String(t, "São Paulo, Brazil. Wien, Österreich.") | |
fmt.Println(result) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment