Deprecated. Don't use for new development and try to migrate existing uses.
This function takes a string and removes any trailing substring that matches the supplied trail-parameter.
If the substring is repeated several times in the trail of the string, then all of these occurrences will be removed.