Expand description
Library for identifying and converting identifiers naming format (case | notation).
It serves three purposes:
-
Judge if an identifier is written in a certain format. (example: is_camel())
-
Automatically identify format with which_case().
-
Convert identifiers between different naming formats. (example: to_camel())
Enums§
- Naming
Case - Indicates which format the string belongs to, and acts as an intermediary between format conversions.
Functions§
- from
- Create a NamingCase value from an identifier.
- from_
hungarian_ notation - Return a Pascal enum for a hungarian notation identifier, remove the first word which representing the variable type.
- is_
camel - Matches
r"^\[a-z]+\d*(\[A-Z]\[a-z]*\d*)*$"
. - is_
kebab - Matches
r"^\[a-z]+\d*(-\[a-z]+\d*)*$"
. - is_
pascal - Matches
r"^(\[A-Z]\[a-z]*\d*)+$"
. - is_
screaming_ snake - Matches
r"^\[A-Z]+\d*(_\[A-Z]+\d*)*$"
. - is_
single_ word - Matches
r"^(?:\[a-z]+|\[A-Z]+|\[A-Z]\[a-z]+)\d*$"
. - is_
snake - Matches
r"^\[a-z]+\d*(_\[a-z]+\d*)*$"
. - which_
case - Determine which format the identifier belongs to. Alias of NamingCase::new() and from().