whatisinternet / Inflector

A rust inflection library
https://docs.rs/Inflector
BSD 2-Clause "Simplified" License
126 stars 28 forks source link

Snake casing not idempotent for strings with a numeric character following a capitalized character #74

Open fordN opened 5 years ago

fordN commented 5 years ago

Current behavior

to_snake_case("convertedAcquisitionV2Counter") => "converted_acquisition_v2_counter"
to_snake_case("converted_acquisition_v2_counter") => "converted_acquisition_v_2_counter"

Which also leads to:

is_snake_case(to_snake_case("convertedAcquisitionV2Counter")) => false

Expected behavior

to_snake_case("convertedAcquisitionV2Counter") => "converted_acquisition_v2_counter"
to_snake_case("converted_acquisition_v2_counter") => "converted_acquisition_v2_counter"
is_snake_case(to_snake_case("convertedAcquisitionV2Counter")) => true