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