This crate provides generic left-padding functions for strings, including both &str
and String
.
Import with extern crate left_pad;
.
Usage example:
``` use leftpad::{leftpad, leftpadwith};
asserteq!(leftpad("blubb", 7), " blubb"); asserteq!(leftpad_with("blubb", 7, '.'), "..blubb");
let s: String = "blubb".toowned(); asserteq!(leftpad(s, 7), " blubb"); ```