diff --git a/init.go b/init.go index 5f7625c..a46e5e9 100644 --- a/init.go +++ b/init.go @@ -1,7 +1,7 @@ package kgo type IntUintBig interface { - ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 + ~int | ~int64 | ~uint | ~uint64 } type IntUintFloat interface { diff --git a/kg_str/arabic_convert.go b/kg_str/arabic_convert.go index aebd82d..d766725 100644 --- a/kg_str/arabic_convert.go +++ b/kg_str/arabic_convert.go @@ -27,10 +27,11 @@ var ( // ArabicToChinese 阿里数字转中文数字 func ArabicToChinese[T kgo.IntUintBig](arabic T) string { + var maxSupportedNum T = 9999_9999_9999 if arabic < 0 { return "" } - if arabic > 9999_9999_9999 { + if arabic > maxSupportedNum { return "" } var ( diff --git a/kg_str/arabic_convert_test.go b/kg_str/arabic_convert_test.go index 39f948a..2979ee8 100644 --- a/kg_str/arabic_convert_test.go +++ b/kg_str/arabic_convert_test.go @@ -54,7 +54,7 @@ func TestArabicToChinese(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if got := ArabicToChinese(tt.args.arabic); got != tt.want { + if got := ArabicToChinese[int](tt.args.arabic); got != tt.want { t.Errorf("ArabicToChinese() = %v, want %v", got, tt.want) } })