Fix one more problem.
This commit is contained in:
parent
248c45d1f6
commit
1e66a194bd
2 changed files with 7 additions and 2 deletions
strmangle
|
@ -205,8 +205,12 @@ func TitleCase(n string) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
buf.WriteByte(word[0] - 32)
|
if c := word[0]; c > 96 && c < 123 {
|
||||||
buf.Write(word[1:])
|
buf.WriteByte(word[0] - 32)
|
||||||
|
buf.Write(word[1:])
|
||||||
|
} else {
|
||||||
|
buf.Write(word)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
start = end + 1
|
start = end + 1
|
||||||
|
|
|
@ -177,6 +177,7 @@ func TestTitleCase(t *testing.T) {
|
||||||
{"zxc_vdf0c0_hello0", "ZXCVDF0C0Hello0"},
|
{"zxc_vdf0c0_hello0", "ZXCVDF0C0Hello0"},
|
||||||
{"id0_uid000_guid0e0", "ID0UID000GUID0E0"},
|
{"id0_uid000_guid0e0", "ID0UID000GUID0E0"},
|
||||||
{"ab_5zxc5d5", "Ab5ZXC5D5"},
|
{"ab_5zxc5d5", "Ab5ZXC5D5"},
|
||||||
|
{"Identifier", "Identifier"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
|
|
Loading…
Add table
Reference in a new issue