SnakeCaseEnum

template SnakeCaseEnum (
T
) if (
is(T == enum)
)

Examples

enum Example : int {
   plain = 12,
   camelCase = 44,
   PascalCase = 100,
   ALL_UPPERCASE = 200
}
alias Snake = SnakeCaseEnum!Example;
assert(Example.plain == Snake.plain);
assert(Example.camelCase == Snake.camel_case);
assert(Example.PascalCase == Snake.pascal_case);
assert(Example.ALL_UPPERCASE == Snake.all_uppercase);

Meta