Function console::pad_str [] [src]

pub fn pad_str<'a>(
    s: &'a str,
    width: usize,
    align: Alignment,
    truncate: Option<&str>
) -> Cow<'a, str>

Pads a string 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.