FCF 2.0 development in progress...
> > > >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

fcf.rtrim() function

string fcf.rtrim(string a_str, string|false|[string|false] a_delimiter = [false])

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

string a_str
- Source string

string|false|[string|false] a_delimiter = [false]
- An array of characters to delete, or a single character string. If the array element is false, characters with code <= 32 are removed.
Result
string
- 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"