2 stable releases

Uses old Rust 2015

1.0.1 Mar 24, 2016

#14 in #pad

Download history 970/week @ 2024-09-20 963/week @ 2024-09-27 692/week @ 2024-10-04 1165/week @ 2024-10-11 1106/week @ 2024-10-18 934/week @ 2024-10-25 1248/week @ 2024-11-01 1056/week @ 2024-11-08 969/week @ 2024-11-15 704/week @ 2024-11-22 859/week @ 2024-11-29 1163/week @ 2024-12-06 637/week @ 2024-12-13 295/week @ 2024-12-20 76/week @ 2024-12-27 181/week @ 2025-01-03

1,389 downloads per month
Used in 2 crates

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