Skip to main content

class_to_class_str

Function class_to_class_str 

Source
pub fn class_to_class_str(text: &str) -> String
Expand description

The class name in the text Python writes for a class, as music21’s classToClassStr cuts it out: whatever follows the last dot, less the closing quote and bracket. A class with no module in its name keeps the rest of the text, as music21’s does.

use music21::common::classtools::class_to_class_str;

assert_eq!(class_to_class_str("<class 'music21.note.Note'>"), "Note");
assert_eq!(class_to_class_str("<class 'int'>"), "<class 'int");