Crate left_pad [] [src]

This crate provides left-padding for strings (including both &str and String).

Import with extern crate left_pad;.

Usage example:

use left_pad::{leftpad, leftpad_with};

assert_eq!(leftpad("blübb", 7), "  blübb");
assert_eq!(leftpad_with("blübb", 7, '→'), "→→blübb");

let s: String = "blübb".to_owned();
assert_eq!(leftpad(s, 7), "  blübb");

Functions

leftpad

Pads a string to the given number of chars by inserting spaces from the left.

leftpad_with

Pads a string to the given number of chars by inserting the character pad_char from the left.