Method in fmt · Buf coil-stdlib

Buf::pad_right

pub fn pad_right(int width, string fill) -> Buf
Import
use fmt::{Buf};
Source: src/fmt.hy

Pads the text on the right with fill until it is at least width bytes long, and returns the builder.

Called on a Buf value as value.pad_right(…).

Parameters#

NameType
widthint
fillstring

Returns#

Buf

Examples#

use fmt::{Buf};
use tests::assert;
let b = Buf::new();
b.push_str("ab");
assert!(b.pad_right(4, ".").to_string() == "ab..");

See also#

  • Buf: A string builder: append pieces, then take the text with to_string.
  • Buf::new: Creates an empty builder.
  • Buf::push_str: Appends s.
  • Buf::push_int: Appends n in decimal.
  • Buf::push_hex: Appends n in lowercase hexadecimal, without a 0x prefix.
  • Buf::to_string: Returns the text built so far.
  • Buf::pad_left: Pads the text on the left with fill until it is at least width bytes long, and returns the builder.
↑ ↓ navigate ↵ open