rtrim
rtrim
Node.js module returns a string with whitespace (or other characters) stripped from the end of a string. Without dependencies and library bloat.
Install
npm install rtrim
or
yarn add rtrim
Usage
Parameter | Description |
---|---|
str |
The input string |
chars |
Characters that you want to be stripped |
Without the second parameter, rtrim
will strip whitespaces (spaces, tabs and new lines).
Examples
var rtrim = ; /* Strip whitespace from the end of a string */ + ' World' // → Hello World /* Strip multiple special chars from the end of a string */; // →... Hello World /* Strip multiple chars from the end of a string */; // →Hello Wor /* Strip trailing slash from the end of a string */; // →https://goo.gl