pub fn leftpad(input: &str, width: usize, padding_char: char) -> StringExpand description
Pads the given string on the left with a specified character up to a specified width.
§Arguments
input- The string to be padded.width- The desired width of the resulting padded string.padding_char- The character used for padding.
§Examples
use leftpad::leftpad;
assert_eq!(leftpad("hello", 8, '*'), "***hello");
assert_eq!(leftpad("rust", 6, ' '), " rust");