#padding #pad

left-pad

Provides left-padding for strings

2 stable releases

Uses old Rust 2015

1.0.1 Mar 24, 2016

#1218 in Rust patterns

Download history 1493/week @ 2022-08-13 1509/week @ 2022-08-20 1679/week @ 2022-08-27 2267/week @ 2022-09-03 1803/week @ 2022-09-10 1293/week @ 2022-09-17 1470/week @ 2022-09-24 1691/week @ 2022-10-01 2097/week @ 2022-10-08 2221/week @ 2022-10-15 2425/week @ 2022-10-22 2076/week @ 2022-10-29 2569/week @ 2022-11-05 2347/week @ 2022-11-12 2441/week @ 2022-11-19 2218/week @ 2022-11-26

9,891 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