lib/Dropbox/Util.php
public static function stripPrefix($s, $prefix, $caseInsensitive = false)
    {
        // substr_compare errors if $main_str is zero-length, so handle that
        // case specially here.
        if (strlen($s) == 0) {
            if (strlen($prefix) == 0) {
                return $s;
            } else {
                return null;
            }
        }

        $prefix_length = strlen($prefix);
        if (\substr_compare($s, $prefix, 0, strlen($prefix), $caseInsensitive) == 0) {
            return substr($s, $prefix_length);
        }
    }
public static function stripPrefix($s, $prefix, $caseInsensitive = false)
    {
        // substr_compare errors if $main_str is zero-length, so handle that
        // case specially here.
        if (strlen($s) == 0) {
            if (strlen($prefix) == 0) {
                return $s;
            } else {
                return null;
            }
        }

        $prefix_length = strlen($prefix);
        if (\substr_compare($s, $prefix, 0, strlen($prefix), $caseInsensitive) == 0) {
            return substr($s, $prefix_length);
        }
    }
public static function stripPrefix ( $ s , $ prefix , $ caseInsensitive = false ) { // substr_compare errors if $main_str is zero-length, so handle that // case specially here. if ( strlen ( $ s ) == 0 ) { if ( strlen ( $ prefix ) == 0 ) { return $ s ; } else { return null ; } } $ prefix_length = strlen ( $ prefix ) ; if ( \ substr_compare ( $ s , $ prefix , 0 , strlen ( $ prefix ) , $ caseInsensitive ) == 0 ) { return substr ( $ s , $ prefix_length ) ; } }
If `$s` starts with `$prefix`, return `$s` with `$prefix` removed.  Otherwise,
return `null`.

@param string $s
@param string $prefix
@param bool $caseInsensitive

@return string|null
If $s starts with $prefix return $s with $prefix removed . Otherwise return null .