Skip to main content

camel_case_to_hyphen

Function camel_case_to_hyphen 

Source
pub fn camel_case_to_hyphen(text: &str, replacement: char) -> String
Expand description

music21’s common.camelCaseToHyphen: a camel-cased name as words joined by replacement, lower case. A capital that starts a run of lower-case letters is set apart first, then any capital following a lower-case letter or a digit, which is the pair of substitutions music21 makes.

use music21::common::stringtools::camel_case_to_hyphen;

assert_eq!(camel_case_to_hyphen("MovementName", '-'), "movement-name");
assert_eq!(camel_case_to_hyphen("fileName", '_'), "file_name");