1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-26 16:09:27 -05:00
denoland-deno/std/strings
2020-03-28 13:03:49 -04:00
..
decode.ts Move everything into std subdir 2019-10-09 17:10:09 -04:00
encode.ts Move everything into std subdir 2019-10-09 17:10:09 -04:00
mod.ts Happy new year! (#3578) 2020-01-02 15:13:47 -05:00
pad.ts Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00
pad_test.ts Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00
README.md Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00

Strings

This module provides a few basic utilities to manipulate strings.

Usage

pad

Input string is processed to output a string with a minimal length. If the parameter strict is set to true, the output string length is equal to the strLen parameter.

Basic usage:

import { pad } from "https://deno.land/std/strings/pad.ts";
pad("deno", 6, { char: "*", side: "left" }); // output : "**deno"
pad("deno", 6, { char: "*", side: "right" }); // output : "deno**"
pad("denosorusrex", 6, {
  char: "*",
  side: "left",
  strict: true,
  strictSide: "right",
  strictChar: "...",
}); // output : "den..."