(n: number): (self: string) => string
(self: string, n: number): stringKeeps the specified number of characters from the start of a string.
Details
If n is larger than the available number of characters, the string will
be returned whole.
If n is not a positive number, an empty string will be returned.
If n is a float, it will be rounded down to the nearest integer.
Example (Taking characters from the start)
import { String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(String.takeLeft("Hello World", 5), "Hello")export const const takeLeft: {
(n: number): (self: string) => string
(self: string, n: number): string
}
Keeps the specified number of characters from the start of a string.
Details
If n is larger than the available number of characters, the string will
be returned whole.
If n is not a positive number, an empty string will be returned.
If n is a float, it will be rounded down to the nearest integer.
Example (Taking characters from the start)
import { String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(String.takeLeft("Hello World", 5), "Hello")
takeLeft: {
(n: numbern: number): (self: stringself: string) => string
(self: stringself: string, n: numbern: number): string
} = import dualdual(2, (self: stringself: string, n: numbern: number): string => self: stringself.String.slice(start?: number, end?: number): stringReturns a section of a string.
slice(0, var Math: MathAn intrinsic object that provides basic mathematics functionality and constants.
Math.Math.max(...values: number[]): numberReturns the larger of a set of supplied numeric expressions.
max(n: numbern, 0)))