(maxLength: number, fillString?: string): (self: string) => stringPads the string from the start with a given fill string to a specified length.
Example (Padding strings at the start)
import { pipe, String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(pipe("a", String.padStart(5)), " a")
assert.deepStrictEqual(pipe("a", String.padStart(5, "_")), "____a")transforming
Source effect/String.ts:7892 lines
export const const padStart: (
maxLength: number,
fillString?: string
) => (self: string) => string
Pads the string from the start with a given fill string to a specified length.
Example (Padding strings at the start)
import { pipe, String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(pipe("a", String.padStart(5)), " a")
assert.deepStrictEqual(pipe("a", String.padStart(5, "_")), "____a")
padStart = (maxLength: numbermaxLength: number, fillString: string | undefinedfillString?: string) => (self: stringself: string): string =>
self: stringself.String.padStart(maxLength: number, fillString?: string): stringPads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
The padding is applied from the start (left) of the current string.
padStart(maxLength: numbermaxLength, fillString: string | undefinedfillString)