#string #str #right #string-formatting #right-pad #string-algorithms

rightpad-str

Obviously the second best crate (after leftpad-str) for the Rust programming language. The crate serves the only goal of implementing rightpad function.

1 stable release

6.6.6 Jun 8, 2023

#296 in Value formatting

MIT license

530KB
62 lines

rightpad-str crate.

Obviously the second best crate (after leftpad-str) for the Rust programming language. The crate serves the only goal of implementing rightpad function:

pub fn rightpad(input: &str, width: usize, padding_char: char) -> String;

Examples

assert_eq!(rightpad("hello", 8, '*'), "hello***");
assert_eq!(rightpad("rust", 6, ' '), "rust  ");

lib.rs:

rightpad-str crate.

Obviously the second best crate (after leftpad-str) for the Rust programming language. The crate serves the only goal of implementing leftpad function:

pub fn rightpad(input: &str, width: usize, padding_char: char) -> String;

No runtime deps