python-case-converter icon indicating copy to clipboard operation
python-case-converter copied to clipboard

Issue in convertions to macro case with numbers

Open gagota opened this issue 10 months ago • 1 comments

For example, for macro_case("ElCurrentPhase2") I would expect "EL_CURRENT_PHASE_2" but I get "EL_CURRENT_PHASE2" instead.

gagota avatar Apr 02 '25 09:04 gagota

This depends a little on the semantics. I don't think you can differentiate between, for example, Phase2 and Phase 2 both of which are valid.

An option could be added to explicitly treat numbers proceeding letters as separate tokens. Ideally we'd default to whatever is most common, I don't have a good way to know that so supporting the existing behavior as default seems like a sane path forward.

chrisdoherty4 avatar Apr 09 '25 18:04 chrisdoherty4