fix: Fix string.title (#2687)

* fix: unsignedTypeMap type error

* fix: string.Title

* style: string.Title test
This commit is contained in:
fyyang
2022-12-11 23:44:19 +08:00
committed by GitHub
parent fdc57d07d7
commit ebe28882eb
3 changed files with 10 additions and 8 deletions

View File

@@ -57,7 +57,7 @@ func (s String) Title() string {
if s.IsEmptyOrSpace() {
return s.source
}
return cases.Title(language.English).String(s.source)
return cases.Title(language.English, cases.NoLower).String(s.source)
}
// ToCamel converts the input text into camel case

View File

@@ -54,6 +54,14 @@ func TestTitle(t *testing.T) {
src: "go zero",
exec: "Go Zero",
},
{
src: "goZero",
exec: "GoZero",
},
{
src: "GoZero",
exec: "GoZero",
},
{
src: "测试this is data",
exec: "测试This Is Data",