Skip to main content

hyphen_to_camel_case

Function hyphen_to_camel_case 

Source
pub fn hyphen_to_camel_case(text: &str, replacement: &str) -> Result<String>
Expand description

A replacement-joined name, movement-name, as a camel-cased one, movementName: music21’s hyphenToCamelCase.

use music21::common::stringtools::hyphen_to_camel_case;

assert_eq!(hyphen_to_camel_case("movement_name", "_")?, "movementName");
assert_eq!(hyphen_to_camel_case("music-21", "-")?, "music21");

§Errors

An empty replacement, which nothing can be split at.