16fccd0a4Sopenharmony_ci# **heck** is a case conversion library 26fccd0a4Sopenharmony_ci 36fccd0a4Sopenharmony_ci 46fccd0a4Sopenharmony_ci 56fccd0a4Sopenharmony_ciThis library exists to provide case conversion between common cases like 66fccd0a4Sopenharmony_ciCamelCase and snake_case. It is intended to be unicode aware, internally 76fccd0a4Sopenharmony_ciconsistent, and reasonably well performing. 86fccd0a4Sopenharmony_ci 96fccd0a4Sopenharmony_ci## Definition of a word boundary 106fccd0a4Sopenharmony_ci 116fccd0a4Sopenharmony_ciWord boundaries are defined as the "unicode words" defined in the 126fccd0a4Sopenharmony_ci`unicode_segmentation` library, as well as within those words in this manner: 136fccd0a4Sopenharmony_ci 146fccd0a4Sopenharmony_ci1. All underscore characters are considered word boundaries. 156fccd0a4Sopenharmony_ci2. If an uppercase character is followed by lowercase letters, a word boundary 166fccd0a4Sopenharmony_ciis considered to be just prior to that uppercase character. 176fccd0a4Sopenharmony_ci3. If multiple uppercase characters are consecutive, they are considered to be 186fccd0a4Sopenharmony_ciwithin a single word, except that the last will be part of the next word if it 196fccd0a4Sopenharmony_ciis followed by lowercase characters (see rule 2). 206fccd0a4Sopenharmony_ci 216fccd0a4Sopenharmony_ciThat is, "HelloWorld" is segmented `Hello|World` whereas "XMLHttpRequest" is 226fccd0a4Sopenharmony_cisegmented `XML|Http|Request`. 236fccd0a4Sopenharmony_ci 246fccd0a4Sopenharmony_ciCharacters not within words (such as spaces, punctuations, and underscores) 256fccd0a4Sopenharmony_ciare not included in the output string except as they are a part of the case 266fccd0a4Sopenharmony_cibeing converted to. Multiple adjacent word boundaries (such as a series of 276fccd0a4Sopenharmony_ciunderscores) are folded into one. ("hello__world" in snake case is therefore 286fccd0a4Sopenharmony_ci"hello_world", not the exact same string). Leading or trailing word boundary 296fccd0a4Sopenharmony_ciindicators are dropped, except insofar as CamelCase capitalizes the first word. 306fccd0a4Sopenharmony_ci 316fccd0a4Sopenharmony_ci## Cases contained in this library: 326fccd0a4Sopenharmony_ci 336fccd0a4Sopenharmony_ci1. UpperCamelCase 346fccd0a4Sopenharmony_ci2. lowerCamelCase 356fccd0a4Sopenharmony_ci3. snake_case 366fccd0a4Sopenharmony_ci4. kebab-case 376fccd0a4Sopenharmony_ci5. SHOUTY_SNAKE_CASE 386fccd0a4Sopenharmony_ci6. Title Case 396fccd0a4Sopenharmony_ci7. SHOUTY-KEBAB-CASE 406fccd0a4Sopenharmony_ci8. Train-Case 416fccd0a4Sopenharmony_ci 426fccd0a4Sopenharmony_ci## Contributing 436fccd0a4Sopenharmony_ci 446fccd0a4Sopenharmony_ciPRs of additional well-established cases welcome. 456fccd0a4Sopenharmony_ci 466fccd0a4Sopenharmony_ciThis library is a little bit opinionated (dropping punctuation, for example). 476fccd0a4Sopenharmony_ciIf that doesn't fit your use case, I hope there is another crate that does. I 486fccd0a4Sopenharmony_ciwould prefer **not** to receive PRs to make this behavior more configurable. 496fccd0a4Sopenharmony_ci 506fccd0a4Sopenharmony_ciBug reports & fixes always welcome. :-) 516fccd0a4Sopenharmony_ci 526fccd0a4Sopenharmony_ci## MSRV 536fccd0a4Sopenharmony_ci 546fccd0a4Sopenharmony_ciThe minimum supported Rust version for this crate is 1.32.0. This may change in 556fccd0a4Sopenharmony_ciminor or patch releases, but we probably won't ever require a very recent 566fccd0a4Sopenharmony_civersion. If you would like to have a stronger guarantee than that, please open 576fccd0a4Sopenharmony_cian issue. 586fccd0a4Sopenharmony_ci 596fccd0a4Sopenharmony_ci## License 606fccd0a4Sopenharmony_ci 616fccd0a4Sopenharmony_ciheck is distributed under the terms of both the MIT license and the 626fccd0a4Sopenharmony_ciApache License (Version 2.0). 636fccd0a4Sopenharmony_ci 646fccd0a4Sopenharmony_ciSee LICENSE-APACHE and LICENSE-MIT for details. 65