KebabCase
A strategy that transforms serial names from camel case to kebab case — lowercase characters with words separated by dashes. The descriptor parameter is not used.
Transformation rules
Words' bounds are defined by uppercase characters. If there is a single uppercase char, it is transformed into lowercase one with a dash in front: twoWords
->two-words
. No dash is added if it was a beginning of the name: MyProperty
->my-property
. Also, no dash is added if it was already there: camel-Case-WithDashes
->camel-case-with-dashes
.
Acronyms
Since acronym rules are quite complex, it is recommended to lowercase all acronyms in source code. If there is an uppercase acronym — a sequence of uppercase chars — they are considered as a whole word from the start to second-to-last character of the sequence: URLMapping
->url-mapping
, myHTTPAuth
->my-http-auth
. Non-letter characters allow the word to continue: myHTTP2APIKey
->my-http2-api-key
, myHTTP2fastApiKey
->my-http2fast-api-key
.
Note on cases
Whether a character is in upper case is determined by the result of Char.isUpperCase function. Lowercase transformation is performed by Char.lowercaseChar, not by Char.lowercase, and therefore does not support one-to-many and many-to-one character mappings. See the documentation of these functions for details.