 
					HUH函数
					A unicode.{IsUpper, Lower}和 B strings.{ToUpper, Lower}都很好对于单个字节组成的数据,A会比B更好如果数据字节不确定,则 B 优于 A:例如中文a1package mainimport (    "strings"    "testing"    "unicode")func IsUpperU(s string) bool {    for _, r := range s {        if !unicode.IsUpper(r) && unicode.IsLetter(r) {            return false        }    }    return true}func IsUpper(s string) bool {    return strings.ToUpper(s) == s}func IsLowerU(s string) bool {    for _, r := range s {        if !unicode.IsLower(r) && unicode.IsLetter(r) {            return false        }    }    return true}func IsLower(s string) bool {    return strings.ToLower(s) == s}func TestIsUpper(t *testing.T) {    for _, d := range []struct {        actual   bool        expected bool    }{        {IsUpperU("中文A1"), false}, // be careful!        {IsUpper("中文A1"), true},        {IsUpper("中文a1"), false},        {IsUpperU("中文a1"), false},    } {        if d.actual != d.expected {            t.Fatal()        }    }}func TestIsLower(t *testing.T) {    for idx, d := range []struct {        actual   bool        expected bool    }{        {IsLowerU("中文a1"), false}, // be careful!        {IsLower("中文a1"), true},        {IsLower("中文A1"), false},        {IsLowerU("中文A1"), false},    } {        if d.actual != d.expected {            t.Fatal(idx)        }    }}go playground