effect-io-ai

Package: effect
Module: String

String.slice

Extracts a section of a string and returns it as a new string.

Example (Slicing strings)

import { pipe, String } from "effect"
import * as assert from "node:assert"

assert.deepStrictEqual(pipe("abcd", String.slice(1, 3)), "bc")
assert.deepStrictEqual(pipe("hello world", String.slice(0, 5)), "hello")

Signature

declare const slice: (start?: number, end?: number) => (self: string) => string

Source

Since v2.0.0