2 stable releases

Uses old Rust 2015

1.0.1 Mar 24, 2016

#1589 in Rust patterns

Download history 1686/week @ 2023-11-23 1663/week @ 2023-11-30 1434/week @ 2023-12-07 1766/week @ 2023-12-14 889/week @ 2023-12-21 822/week @ 2023-12-28 1708/week @ 2024-01-04 1859/week @ 2024-01-11 1819/week @ 2024-01-18 1723/week @ 2024-01-25 1825/week @ 2024-02-01 1638/week @ 2024-02-08 1920/week @ 2024-02-15 1888/week @ 2024-02-22 1640/week @ 2024-02-29 1456/week @ 2024-03-07

7,216 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