Skip to main content

string_format

Function string_format 

Source
pub fn string_format(
    input: &str,
    formatting: &StringReplacementPair<'_>,
) -> RUMString
Expand description

Given a set of keys and replacements, transform the input string.

ยงExample

use rumtk_core::strings::string_format;
use rumtk_core::types::RUMBuffer;

const expected: &str = "Hello World!";
const template: &str = "Hello {}!";
let result = string_format(template, &[("{}", "World")]);

assert_eq!(result.as_str(), expected, "Formatting of string failed!");