Crate leftpad_rs[][src]

Expand description

Leftpad implementation in Rust.

This is a Rust implementation of the famous Leftpad NPM package with pad() and pad_char(). Based on the Go implementation I wrote back in 2018.

Examples:

  use leftpad_rs::{pad,pad_char};

  let r = pad("foo", 5);  // -> "  foo"

  let s = pad_char("foo", 6, 'X');    // -> "XXXfoo"

Functions

This module implements pad and pad_char. Left-pads the string with spaces.

Left-pads the string with the supplied character.

Useful alias