Strings.suffix()
Syntax
function suffix(string: string, suffix: string): string
Adds a suffix to a string if it does not yet exist.
Parameters | |
string
|
The string to suffix. |
suffix
|
The suffix to add. If the string already ends with this suffix, this function does nothing. |
Example
import { Strings } from 'potence';
Strings.suffix('awesome-filename', '.md'); // -> 'awesome-filename.md'
Strings.suffix('awesome-filename.md', '.md'); // -> 'awesome-filename.md'
Remarks
Compare Strings.prefix()
.