(searchString: string, position?: number): (self: string) => booleanReturns true if the string starts with the specified search string.
Example (Checking string prefixes)
import { pipe, String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(pipe("hello world", String.startsWith("hello")), true)
assert.deepStrictEqual(pipe("hello world", String.startsWith("world")), false)predicates
Source effect/String.ts:5002 lines
export const const startsWith: (
searchString: string,
position?: number
) => (self: string) => boolean
Returns true if the string starts with the specified search string.
Example (Checking string prefixes)
import { pipe, String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(pipe("hello world", String.startsWith("hello")), true)
assert.deepStrictEqual(pipe("hello world", String.startsWith("world")), false)
startsWith = (searchString: stringsearchString: string, position: number | undefinedposition?: number) => (self: stringself: string): boolean =>
self: stringself.String.startsWith(searchString: string, position?: number): booleanReturns true if the sequence of elements of searchString converted to a String is the
same as the corresponding elements of this object (converted to a String) starting at
position. Otherwise returns false.
startsWith(searchString: stringsearchString, position: number | undefinedposition)