npm-stringutils
v1.0.1
Published
Simplifying string operations
Downloads
124
Readme
NPM StringUtils
Simple NPM library to simplify common string operations.
Setup
npm install npm-stringutils
Usage
Import the required methods:
const { isBlank, isEmpty, getLength, getCount, getTitleCase } = require('npm-stringutils');
- isBlank: Returns true if string is null, empty or whitespaces, else returns false.
if (isBlank(" your string ")) {
...
} else {
...
}
isEmpty: Returns true is string is null or empty, else returns false.
getLength: Returns length of the given string.
getCount: Returns count of the given character in the given string.
getTitleCase: Returns title cased value for the given string, i.e, first character of all the words will be capitalized.