Uppercase any non-words (words w/o vowels aeiouy)
* This lets us find accronyms easily, example: db, ssn, tx, etc.
This commit is contained in:
parent
76d4b84019
commit
984e5f9bac
2 changed files with 6 additions and 1 deletions
strmangle
|
@ -15,7 +15,7 @@ import (
|
|||
|
||||
var (
|
||||
idAlphabet = []byte("abcdefghijklmnopqrstuvwxyz")
|
||||
uppercaseWords = regexp.MustCompile(`^(?i)(id|uid|db|uuid|guid|ssn|tz)[0-9]*$`)
|
||||
uppercaseWords = regexp.MustCompile(`^(?i)(id|uid|uuid|guid|[^aeiouy]*)[0-9]*$`)
|
||||
smartQuoteRgx = regexp.MustCompile(`^(?i)"?[a-z_][_a-z0-9]*"?(\."?[_a-z][_a-z0-9]*"?)*(\.\*)?$`)
|
||||
)
|
||||
|
||||
|
|
|
@ -163,6 +163,11 @@ func TestTitleCase(t *testing.T) {
|
|||
{"guid_thing", "GUIDThing"},
|
||||
{"thing_guid_thing", "ThingGUIDThing"},
|
||||
{"id", "ID"},
|
||||
{"gvzxc", "GVZXC"},
|
||||
{"id_trgb_id", "IDTRGBID"},
|
||||
{"vzxx_vxccb_nmx", "VZXXVXCCBNMX"},
|
||||
{"thing_zxc_stuff_vxz", "ThingZXCStuffVXZ"},
|
||||
{"zxc_thing_vxz_stuff", "ZXCThingVXZStuff"},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
|
Loading…
Add table
Reference in a new issue