#string #str #left #left-pad #string-formatting #string-algorithms

leftpad-str

Obviously the best crate for the Rust programming language. The crate serves the only goal of implementing leftpad function.

2 stable releases

9.9.9 Jun 8, 2023
6.6.6 Jun 8, 2023

#19 in #left

MIT license

540KB
66 lines

leftpad-str crate.

Obviously the best crate for the Rust programming language. The crate serves the only goal of implementing leftpad function:

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

Examples

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

lib.rs:

leftpad-str crate.

Obviously the best crate for the Rust programming language. The crate serves the only goal of implementing leftpad function:

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

No runtime deps