Skip to main content

str_repr

Function str_repr 

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

A string as Python’s repr writes it, in single quotes unless it holds one and no double quote.

use music21::common::stringtools::str_repr;

assert_eq!(str_repr("(\n"), "'(\\n'");
assert_eq!(str_repr("it's"), "\"it's\"");