Skip to main content

indent_string_with

Function indent_string_with 

Source
pub fn indent_string_with(
    string: &str,
    count: usize,
    indent: &str,
    include_empty_lines: bool,
) -> String
Expand description

Indent each line of string with count repetitions of indent.

When include_empty_lines is false (the default in indent_string), empty and whitespace-only lines are left unchanged. A count of 0 returns the string unchanged.

assert_eq!(indent_string_with("x\ny", 3, "-", false), "---x\n---y");