Function uucore::memo::sprintf

source ·
pub fn sprintf(format_string: &str, args: &[String]) -> UResult<String>
Expand description

Create a new formatted string.

format_string contains the template and args contains the arguments to render into the template.

See also printf, which prints to stdout.

Examples

use uucore::memo::sprintf;

let s = sprintf("hello %s", &["world".to_string()]).unwrap();
assert_eq!(s, "hello world".to_string());