- empty
- endsWith
- includes
- isEmpty
- replace
- size
- slice
- split
- startsWith
- toLowerCase
- toUpperCase
- trim
- trimLeft
- trimRight
export declare const Eq: E.Eq<string>
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
assert.deepStrictEqual(S.Eq.equals('a', 'a'), true)
assert.deepStrictEqual(S.Eq.equals('a', 'b'), false)
- MIT – Copyright (c) 2017-present Giulio Canti
string
monoid under concatenation.
The empty
value is ''
.
export declare const Monoid: M.Monoid<string>
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
assert.deepStrictEqual(S.Monoid.concat('a', 'b'), 'ab')
assert.deepStrictEqual(S.Monoid.concat('a', S.Monoid.empty), 'a')
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const Ord: O.Ord<string>
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
assert.deepStrictEqual(S.Ord.compare('a', 'a'), 0)
assert.deepStrictEqual(S.Ord.compare('a', 'b'), -1)
assert.deepStrictEqual(S.Ord.compare('b', 'a'), 1)
- MIT – Copyright (c) 2017-present Giulio Canti
string
semigroup under concatenation.
export declare const Semigroup: S.Semigroup<string>
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
assert.deepStrictEqual(S.Semigroup.concat('a', 'b'), 'ab')
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const Show: Sh.Show<string>
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
assert.deepStrictEqual(S.Show.show('a'), '"a"')
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const isString: Refinement<unknown, string>
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
assert.deepStrictEqual(S.isString('a'), true)
assert.deepStrictEqual(S.isString(1), false)
- MIT – Copyright (c) 2017-present Giulio Canti
An empty string
.
export declare const empty = ''
- Added in 0.1.0
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const endsWith: (searchString: string, position?: number) => (s: string) => boolean
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe('abc', S.endsWith('c')), true)
assert.deepStrictEqual(pipe('ab', S.endsWith('c')), false)
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const includes: (searchString: string, position?: number) => (s: string) => boolean
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe('abc', S.includes('b')), true)
assert.deepStrictEqual(pipe('abc', S.includes('d')), false)
- MIT – Copyright (c) 2017-present Giulio Canti
Test whether a string
is empty.
export declare const isEmpty: (s: string) => boolean
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe('', S.isEmpty), true)
assert.deepStrictEqual(pipe('a', S.isEmpty), false)
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const replace: (searchValue: string | RegExp, replaceValue: string) => (s: string) => string
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe('abc', S.replace('b', 'd')), 'adc')
- MIT – Copyright (c) 2017-present Giulio Canti
Calculate the number of characters in a string
.
export declare const size: (s: string) => number
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe('abc', S.size), 3)
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const slice: (start: number, end: number) => (s: string) => string
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe('abcd', S.slice(1, 3)), 'bc')
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const split: (separator: string | RegExp) => (s: string) => ReadonlyNonEmptyArray<string>
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe('abc', S.split('')), ['a', 'b', 'c'])
assert.deepStrictEqual(pipe('', S.split('')), [''])
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const startsWith: (searchString: string, position?: number) => (s: string) => boolean
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe('abc', S.startsWith('a')), true)
assert.deepStrictEqual(pipe('bc', S.startsWith('a')), false)
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const toLowerCase: (s: string) => string
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe('A', S.toLowerCase), 'a')
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const toUpperCase: (s: string) => string
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe('a', S.toUpperCase), 'A')
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const trim: (s: string) => string
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe(' a ', S.trim), 'a')
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const trimLeft: (s: string) => string
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe(' a ', S.trimLeft), 'a ')
- MIT – Copyright (c) 2017-present Giulio Canti
export declare const trimRight: (s: string) => string
- Added in 0.1.0
import * as S from '@fp-tx/core/string'
import { pipe } from '@fp-tx/core/function'
assert.deepStrictEqual(pipe(' a ', S.trimRight), ' a')
- MIT – Copyright (c) 2017-present Giulio Canti