2019-03-18 11:08:01 -04:00
|
|
|
# Strings
|
|
|
|
|
|
|
|
This module provides a few basic utilities to manipulate strings.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
### pad
|
|
|
|
|
2019-10-09 17:22:22 -04:00
|
|
|
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.
|
2019-03-18 11:08:01 -04:00
|
|
|
|
|
|
|
Basic usage:
|
|
|
|
|
|
|
|
```ts
|
|
|
|
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..."
|
|
|
|
```
|