@wtasnorg/node-lib / trimSuffixString
trimSuffixString(
s,suffix):string
Defined in: src/strings.ts:1183
TrimSuffix returns s without the provided trailing suffix string. If s doesn’t end with suffix, s is returned unchanged.
string
Input string.
string
Suffix to remove.
string
String without the suffix.
trimSuffix("Hello, goodbye!", ", goodbye!"); // "Hello"
trimSuffix("Hello, world!", "Goodbye"); // "Hello, world!" — suffix not found
trimSuffix("ab", "abc"); // "ab" — suffix longer than s
trimSuffix("", "abc"); // "" — empty string