Ensures that the string ends with $substring. If it doesn't, it's appended.

string:ensure_end(STRING $string, STRING $ending) : STRING

string:ensure_end('hi','!')
#=> "hi!"

# don't add the ending, if it already exists
string:ensure_end('hi!','!')
#=> "hi!"

string:ensure_end('hi','')
#=> "hi"

string:ensure_end('','')
#=> ""

Copyright ©2013-2022 SunSed®. All rights reserved.