Skip to main content

pad_right

Function pad_right 

Source
pub fn pad_right(s: &str, width: usize) -> String
Expand description

Pads a string on the right (left-aligns) to reach the target width.

ANSI escape codes are preserved and don’t count toward width calculations.

§Example

use standout::tabular::pad_right;

assert_eq!(pad_right("42", 5), "42   ");
assert_eq!(pad_right("hello", 3), "hello");  // No truncation