Ensure suffix, if str does not end with suffix, it will be added
确保后缀,如果字符串不以该后缀结尾,则将添加该后缀。
The string to check. 要检查的字符串
The suffix to ensure. 要确保的后缀
The string with the suffix ensured. 确保后缀后的字符串
ensureSuffix('example.com', '.com') // => example.comensureSuffix('example', '.com') // => example.com Copy
ensureSuffix('example.com', '.com') // => example.comensureSuffix('example', '.com') // => example.com
Ensure suffix, if str does not end with suffix, it will be added
确保后缀,如果字符串不以该后缀结尾,则将添加该后缀。