Skip to main content

convert_subscripts

Function convert_subscripts 

Source
pub fn convert_subscripts(
    old_sub: &[&str],
    symbol_map: &BTreeMap<&str, &str>,
) -> String
Expand description

Convert user custom subscripts list to subscript string according to symbol_map.

ยงExamples

let symbol_map = BTreeMap::from([("abc", "a"), ("def", "b")]);
assert_eq!(convert_subscripts(&["abc", "def"], &symbol_map), "ab");
// with ellipsis
let symbol_map = BTreeMap::from([("ast", "a")]);
assert_eq!(convert_subscripts(&["ast", "ast", "..."], &symbol_map), "aa...");