SnakeCase

A strategy that transforms serial names from camel case to snake case — lowercase characters with words separated by underscores. 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 underscore in front: twoWords ->two_words. No underscore is added if it was a beginning of the name: MyProperty ->my_property. Also, no underscore is added if it was already there: camel_Case_Underscores ->camel_case_underscores.

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.