2 stable releases
Uses old Rust 2015
1.0.1 | Mar 24, 2016 |
---|
#14 in #pad
4,444 downloads per month
Used in kik
3KB
leftpad-rs
This crate provides generic left-padding functions for strings, including both &str
and String
.
Import with extern crate left_pad;
.
Link to the documentation
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");