Removes the specified prefix from a string if it exists.
The string to process.
The prefix to remove.
Optional
The string without the prefix if it was present; otherwise, returns the original string.
1.1.0
removePrefix("unhappy", "un"); // "happy"removePrefix("hello", "he"); // "llo"removePrefix("world", "un"); // "world" (prefix not found) Copy
removePrefix("unhappy", "un"); // "happy"removePrefix("hello", "he"); // "llo"removePrefix("world", "un"); // "world" (prefix not found)
Removes the specified prefix from a string if it exists.