2 stable releases

Uses old Rust 2015

1.0.1 Mar 24, 2016

#14 in #pad

Download history 1210/week @ 2024-07-21 1101/week @ 2024-07-28 1135/week @ 2024-08-04 1109/week @ 2024-08-11 1105/week @ 2024-08-18 1176/week @ 2024-08-25 946/week @ 2024-09-01 1207/week @ 2024-09-08 794/week @ 2024-09-15 1101/week @ 2024-09-22 847/week @ 2024-09-29 815/week @ 2024-10-06 1259/week @ 2024-10-13 912/week @ 2024-10-20 981/week @ 2024-10-27 1226/week @ 2024-11-03

4,444 downloads per month
Used in kik

MIT license

3KB

leftpad-rs

This crate provides generic left-padding functions for strings, including both &str and String.

Import with extern crate left_pad;.

Usage example:

use left_pad::{leftpad, leftpad_with};

assert_eq!(leftpad("blubb", 7), "  blubb");
assert_eq!(leftpad_with("blubb", 7, '.'), "..blubb");

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

lib.rs:

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("blubb", 7), "  blubb");
assert_eq!(leftpad_with("blubb", 7, '.'), "..blubb");

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

No runtime deps