2 stable releases

Uses old Rust 2015

1.0.1 Mar 24, 2016

#11 in #pad

Download history 891/week @ 2024-11-16 742/week @ 2024-11-23 839/week @ 2024-11-30 1144/week @ 2024-12-07 617/week @ 2024-12-14 267/week @ 2024-12-21 66/week @ 2024-12-28 223/week @ 2025-01-04 297/week @ 2025-01-11 217/week @ 2025-01-18 368/week @ 2025-01-25 1414/week @ 2025-02-01 1552/week @ 2025-02-08 1760/week @ 2025-02-15 1974/week @ 2025-02-22 1563/week @ 2025-03-01

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