Crate naming_lib

Source
Expand description

Library for identifying and converting identifiers naming format (case | notation).

It serves three purposes:

  1. Judge if an identifier is written in a certain format. (example: is_camel())

  2. Automatically identify format with which_case().

  3. Convert identifiers between different naming formats. (example: to_camel())

Enums§

NamingCase
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().