Skip to content

unchainedui/strings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unchained UI

Strings

NPM Version NPM Downloads

Various functions to work with strings

Usage

Just import methods you need

import { length } from 'uc-strings'

Methods

length(str)

return the proper length of the string. Counts the actual characters and not unicode surrogate pairs

substring(str, begin, end)

return the proper substring from the string. Counts the actual characters and not unicode surrogate pairs

removeHash(str)

Removes # symbol from the beginig of the string

removeQuotes(str)

Removes ' or " quotes form the begining and end of the string

toCamelCase(str)

Transfroms _ or - cases into camelCase

pluralize(single, plural, opts)

Return the function that accepts a number and return a string with corresponded word.

Optios are:

  • zeroIsEmpty – boolean, default false. If true return empty string when number is zero.

slugify(str)

Returns slugified string

License MIT

© velocityzen

About

Various functions to work with strings

Resources

License

Stars

Watchers

Forks

Packages

No packages published