@wtasnorg/node-lib / trimPrefixString
trimPrefixString(
s,prefix):string
Defined in: src/strings.ts:1112
TrimPrefix returns s without the provided leading prefix string. If s doesn’t start with prefix, s is returned unchanged.
string
Input string.
string
Prefix to remove.
string
String without the prefix.
trimPrefix("Goodbye, world!", "Goodbye, "); // "world!"
trimPrefix("Hello, world!", "Goodbye, "); // "Hello, world!" — prefix not found
trimPrefix("ab", "abc"); // "ab" — prefix longer than s
trimPrefix("", "abc"); // "" — empty string