Fix one more problem.

This commit is contained in:
Aaron L 2016-08-21 23:00:22 -07:00
parent 248c45d1f6
commit 1e66a194bd
2 changed files with 7 additions and 2 deletions

View file

@ -205,8 +205,12 @@ func TitleCase(n string) string {
}
}
} else {
buf.WriteByte(word[0] - 32)
buf.Write(word[1:])
if c := word[0]; c > 96 && c < 123 {
buf.WriteByte(word[0] - 32)
buf.Write(word[1:])
} else {
buf.Write(word)
}
}
start = end + 1

View file

@ -177,6 +177,7 @@ func TestTitleCase(t *testing.T) {
{"zxc_vdf0c0_hello0", "ZXCVDF0C0Hello0"},
{"id0_uid000_guid0e0", "ID0UID000GUID0E0"},
{"ab_5zxc5d5", "Ab5ZXC5D5"},
{"Identifier", "Identifier"},
}
for i, test := range tests {