src/Utilities/Miscellaneous.php
public static function removeEndingDirectorySeparator($text, $separator = '')
    {
        /*
         * Not a string?
         * Nothing to do
         */
        if (!is_string($text)) {
            return '';
        }

        if (empty($separator)) {
            $separator = DIRECTORY_SEPARATOR;
        }

        $effect = trim($text);

        if (Regex::endsWithDirectorySeparator($effect, $separator)) {
            $effect = mb_substr($effect, 0, mb_strlen($effect) - mb_strlen($separator));
        }

        return $effect;
    }
public static function removeEndingDirectorySeparator($text, $separator = '')
    {
        /*
         * Not a string?
         * Nothing to do
         */
        if (!is_string($text)) {
            return '';
        }

        if (empty($separator)) {
            $separator = DIRECTORY_SEPARATOR;
        }

        $effect = trim($text);

        if (Regex::endsWithDirectorySeparator($effect, $separator)) {
            $effect = mb_substr($effect, 0, mb_strlen($effect) - mb_strlen($separator));
        }

        return $effect;
    }
public static function removeEndingDirectorySeparator ( $ text , $ separator = '' ) { /*
         * Not a string?
         * Nothing to do
         */ if ( ! is_string ( $ text ) ) { return '' ; } if ( empty ( $ separator ) ) { $ separator = DIRECTORY_SEPARATOR ; } $ effect = trim ( $ text ) ; if ( Regex :: endsWithDirectorySeparator ( $ effect , $ separator ) ) { $ effect = mb_substr ( $ effect , 0 , mb_strlen ( $ effect ) - mb_strlen ( $ separator ) ) ; } return $ effect ; }
Removes the ending directory's separator

@param string $text      Text that may contain a directory's separator at the end
@param string $separator (optional) The directory's separator, e.g. "/". If is empty (not provided), system's
separator is used.
@return string
Removes the ending directory s separator