Ensures that a string ends with a specified substring. If the string already ends 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.
strEnsureEndsWith('52', ' kg');//=> '52 kg'strEnsureEndsWith('52 kg', ' kg');//=> '52 kg' Copy
strEnsureEndsWith('52', ' kg');//=> '52 kg'strEnsureEndsWith('52 kg', ' kg');//=> '52 kg'
Generated using TypeDoc
Ensures that a string ends with a specified substring. If the string already ends with the specified substring, it is returned as is. Otherwise, the substring is appended to the end of the string.