Skip to content

Commit

Permalink
fix(文本): 修复驼峰算法
Browse files Browse the repository at this point in the history
  • Loading branch information
storezhang committed Sep 20, 2024
1 parent eec32ba commit 89cb2c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/text/internal/core/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ func (s *Switch) camel() string {
switch {
case 0 == index && kernel.PositionHead == s.params.Position:
buffer.WriteRune(unicode.ToUpper(rune(word[0])))
case 0 == index && kernel.PositionNone == s.params.Position:
buffer.WriteRune(rune(word[0]))
case 0 == index && kernel.PositionHead != s.params.Position:
buffer.WriteRune(unicode.ToLower(rune(word[0])))
default:
buffer.WriteRune(unicode.ToUpper(rune(word[0])))
}
Expand Down
2 changes: 1 addition & 1 deletion string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestCamel(t *testing.T) {
{"a b", "aB"},
{"a_b", "aB"},
{"a-b", "aB"},
{"Db", "Db"},
{"Db", "db"},
}
for index, test := range tests {
camel := gox.String(test.in).Switch().Camel().Build()
Expand Down

0 comments on commit 89cb2c0

Please sign in to comment.