Skip to main content

space_camel_case

Function space_camel_case 

Source
pub fn space_camel_case(
    text: &str,
    replace_underscore: bool,
    keep_together: &[&str],
) -> String
Expand description

A camel-cased name, or one of letters and numbers, spaced into words: music21’s spaceCamelCase. A space goes before each capital and where numbers start or stop; each of keep_together, spaced out, is joined up again, and with replace_underscore an underscore is a space too. music21 keeps PMFC together where it is given nothing to keep.

use music21::common::stringtools::space_camel_case;

assert_eq!(space_camel_case("opus41no1", true, &["PMFC"]), "opus 41 no 1");
assert_eq!(space_camel_case("PMFC22", true, &["PMFC"]), "PMFC 22");
assert_eq!(space_camel_case("hello_myke", false, &["PMFC"]), "hello_myke");