decamelize
Convert a camelCase string to a separated lower-case string.
fooBar → foo_bar, unicornsAndRainbows → unicorns_and_rainbows,
XMLHttpRequest → xml_http_request. A faithful Rust port of the widely-used
decamelize npm package.
- Zero dependencies,
#![no_std] - Custom separator and a
preserveConsecutiveUppercasemode - Differential-tested against the reference
decamelizeimplementation
Install
[]
= "0.1"
Usage
use ;
assert_eq!;
assert_eq!;
assert_eq!;
// Custom separator:
assert_eq!;
assert_eq!;
// Preserve consecutive uppercase runs:
assert_eq!;
assert_eq!;
Contributors ✨
This project follows the all-contributors specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the emoji key for how each contribution is recognized, and open a PR or issue to get involved.
Thanks goes to these wonderful people:
License
Licensed under either of MIT or Apache-2.0 at your option.