<A extends string>(self: A): TrimStart<A>Removes whitespace from the start of a string.
Example (Trimming leading whitespace)
import { String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(String.trimStart(" a "), "a ")
assert.deepStrictEqual(String.trimStart(" hello world"), "hello world")transforming
Source effect/String.ts:3321 lines
export const const trimStart: <A extends string>(
self: A
) => TrimStart<A>
Removes whitespace from the start of a string.
Example (Trimming leading whitespace)
import { String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(String.trimStart(" a "), "a ")
assert.deepStrictEqual(String.trimStart(" hello world"), "hello world")
trimStart = <function (type parameter) A in <A extends string>(self: A): TrimStart<A>A extends string>(self: A extends stringself: function (type parameter) A in <A extends string>(self: A): TrimStart<A>A): type TrimStart<A extends string> =
A extends
| ` ${infer B}`
| `
${infer B}`
| `\t${infer B}`
| `\r${infer B}`
? TrimStart<B>
: A
Type-level representation of trimming whitespace from the start of a string.
Example (Trimming leading whitespace at the type level)
import type { String } from "effect"
type Result = String.TrimStart<" hello"> // "hello"
TrimStart<function (type parameter) A in <A extends string>(self: A): TrimStart<A>A> => self: A extends stringself.String.trimStart(): stringRemoves the leading white space and line terminator characters from a string.
trimStart() as type TrimStart<A extends string> =
A extends
| ` ${infer B}`
| `
${infer B}`
| `\t${infer B}`
| `\r${infer B}`
? TrimStart<B>
: A
Type-level representation of trimming whitespace from the start of a string.
Example (Trimming leading whitespace at the type level)
import type { String } from "effect"
type Result = String.TrimStart<" hello"> // "hello"
TrimStart<function (type parameter) A in <A extends string>(self: A): TrimStart<A>A>