1.0.0 • Published 5 years ago
strings-util v1.0.0
strings-util
String utility methods.
Install
$ npm install strings-util
Usage
const stringsUtil = require('strings-util');
stringsUtil.trim(' test ');
// => "test"
stringsUtil.trimLeft(' test ');
// => "test "
stringsUtil.trimRight(' test ');
// => " test"
stringsUtil.startsWith('test string', 'test');
// => true
stringsUtil.endsWith('test string', 'string');
// => true
stringsUtil.capitalize('test');
// => "Test"
stringsUtil.capitalize('test string');
// => "Test String"
API
string trim(str)
Trims leading and trailing whitespace from the given string.
string trimLeft(str)
Removes whitespace from the left end of the string.
string trimRight(str)
Removes whitespace from the right end of the string.
boolean startsWith(str, prefix)
Checks whether str starts with prefix.
boolean endsWith(str, suffix)
Checks whether str ends with suffix.
string capitalize(str)
Transforms the first character of each word to uppercase; other characters are unaffected.
Resources
1.0.0
5 years ago