pub fn indent<S: AsRef<str>>(
s: S,
num_of_indents: usize,
spaces_per_indent: usize,
) -> String
Expand description
Indent text
ยงExamples
fn hello_newline_world() {
assert_eq!(" hello\n world", indentasy::indent("hello\nworld", 1, 4));
}
fn newline_hello_newline_world() {
assert_eq!(
"\n hello\n world",
indentasy::indent("\nhello\nworld", 1, 4)
);
}
fn hello_newline_world_indent_with_tab() {
assert_eq!("\thello\n\tworld", indentasy::indent("hello\nworld", 1, 0));
}
fn hello_newline_world_with_String() {
assert_eq!(
" hello\n world",
indentasy::indent("hello\nworld".to_string(), 1, 4)
);
}