(n: number): (self: string) => string
(self: string, n: number): stringKeeps the specified number of characters from the end 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 end)
import { String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(String.takeRight("Hello World", 5), "World")export const const takeRight: {
(n: number): (self: string) => string
(self: string, n: number): string
}
Keeps the specified number of characters from the end 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 end)
import { String } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(String.takeRight("Hello World", 5), "World")
takeRight: {
(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(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(0, self: stringself.String.length: numberReturns the length of a String object.
length - var Math: MathAn intrinsic object that provides basic mathematics functionality and constants.
Math.Math.floor(x: number): numberReturns the greatest integer less than or equal to its numeric argument.
floor(n: numbern)), var Infinity: numberInfinity)
)