Skip to content

Latest commit

 

History

History
188 lines (128 loc) · 2.81 KB

text.md

File metadata and controls

188 lines (128 loc) · 2.81 KB

Module iiris/text

The iiris/text module includes functions for working with text. It is designed to be imported with a wildcard, e.g.

import * as T from 'iiris/text'

Table of contents

String

capitalize

(string: string) => string

Convert the first code point of string to uppercase and the rest to lowercase.

Example
T.capitalize('aBc')
// => 'Abc'

See also: toLowerCase, toUpperCase


split

(separator: RegExp | string) => (string: string) => string

Split the string into an array of substrings between each separator.

Example
T.split(', ', 'a, b, c')
// => ['a', 'b', 'c']

See also: join


test

(regexp: RegExp) => (string: string) => boolean

Check if string matches the regexp.

Example
T.test(/abc/, 'abc')
// => true

toLowerCase

(string: string) => string

Convert string to lowercase.

Example
T.toLowerCase('ABC')
// => 'abc'

See also: toUpperCase, capitalize


toUpperCase

(string: string) => string

Convert string to uppercase.

Example
T.toUpperCase('abc')
// => 'ABC'

See also: toLowerCase, capitalize


trim

(string: string) => string

Remove whitespace from both ends of a string.

Example
T.trim('  abc  ')
// => 'abc'

See also: trimStart, trimEnd


trimEnd

(string: string) => string

Remove whitespace from the end of a string.

Example
T.trimEnd('  abc  ')
// => '  abc'

See also: trimStart, trim


trimStart

(string: string) => string

Remove whitespace from the beginning of a string.

Example
T.trimStart('  abc  ')
// => 'abc  '

See also: trimEnd, trim