fn pad_left(s: &str, total_len: usize, pad_char: char) -> String {
let pad_len = total_len.saturating_sub(s.len());
format!("{}{}", pad_char.to_string().repeat(pad_len), s)
}
fn main() {
let padded = pad_left("Rust", 7, '*');
println!("{}", padded);
}
/*
run:
***Rust
*/