Merge pull request #249 from go-vgo/dev

Update to utf-code function Fixed #189
This commit is contained in:
vz 2019-12-10 07:42:24 -04:00 committed by GitHub
commit bfa0ad7821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -700,12 +700,12 @@ func CharCodeAt(s string, n int) rune {
func toUC(text string) []string {
var uc []string
textQuoted := strconv.QuoteToASCII(text)
textUnquoted := textQuoted[1 : len(textQuoted)-1]
for _, r := range text {
textQ := strconv.QuoteToASCII(string(r))
textUnQ := textQ[1 : len(textQ)-1]
strUnicodev := strings.Split(textUnquoted, "\\u")
for i := 1; i < len(strUnicodev); i++ {
uc = append(uc, "U"+strUnicodev[i])
st := strings.Replace(textUnQ, "\\u", "U", -1)
uc = append(uc, st)
}
return uc