Ensures that a string starts with a specified substring. If the string already starts with the specified substring, it is returned as is. Otherwise, the substring is appended to the end of the string.
The string to be processed.
The substring that the string should end with.
strEnsureStartsWith('json', '.');//=> '.json'strEnsureStartsWith('.json', '.');//=> '.json' Copy
strEnsureStartsWith('json', '.');//=> '.json'strEnsureStartsWith('.json', '.');//=> '.json'
Generated using TypeDoc
Ensures that a string starts with a specified substring. If the string already starts with the specified substring, it is returned as is. Otherwise, the substring is appended to the end of the string.