fcf.rtrim() function
Package: fcf-framework-core
File: fcf-framework-core:fcf.js
Available from version: 2.0.2
Removes the specified characters from the end of a string
Arguments
- Source string
- An array of characters to delete, or a single character string. If the array element is false, characters with code <= 32 are removed.
Result
- Result string
Example: Default mode
let newString = fcf.rtrim(` test string `);
console.log(`"${newString}"`);
Output:
" test string"
Example: Single delimiter
let newString = fcf.rtrim(`/path/file/`, "/");
console.log(`"${newString}"`);
Output:
"/path/file"
Example: Multiple delimiter
let newString = fcf.rtrim(`/path/file / \\ `, ["/","\\", false]);
console.log(`"${newString}"`);
Output:
"/path/file"