Hyperlinkv0.8.0-beta.28

String

String.sliceconsteffect/String.ts:384
(start?: number, end?: number): (self: string) => string

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")
transforming
Source effect/String.ts:3841 lines
export const slice = (start?: number, end?: number) => (self: string): string => self.slice(start, end)