Function console::pad_str_with

source ·
pub fn pad_str_with<'a>(
    s: &'a str,
    width: usize,
    align: Alignment,
    truncate: Option<&str>,
    pad: char
) -> Cow<'a, str>
Expand description

Pads a string with specific padding to fill a certain number of characters.

This will honor ansi codes correctly and allows you to align a string on the left, right or centered. Additionally truncation can be enabled by setting truncate to a string that should be used as a truncation marker.