pub fn sprintf<'a>(
format_string: impl AsRef<[u8]>,
arguments: impl IntoIterator<Item = &'a FormatArgument>,
) -> Result<Vec<u8>, FormatError>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::format::{sprintf, FormatArgument};
let s = sprintf("hello %s", &[FormatArgument::String("world".into())]).unwrap();
let s = std::str::from_utf8(&s).unwrap();
assert_eq!(s, "hello world");