public static boolean uriEndsWith( String uri, String ending )
    {
        int queryStart = uri.indexOf( '?' );
        
        if ( queryStart == -1 )
        {
            return uri.endsWith( ending );
        }
        else
        {
            return uri.length() - queryStart >= ending.length()
                   && uri.substring( queryStart - ending.length(), queryStart ).equals( ending );
        }
    }
public static boolean uriEndsWith ( String uri , String ending ) { int queryStart = uri . indexOf ( '?' ) ; if ( queryStart == - 1 ) { return uri . endsWith ( ending ) ; } else { return uri . length ( ) - queryStart >= ending . length ( ) && uri . substring ( queryStart - ending . length ( ) , queryStart ) . equals ( ending ) ; } }
Tell whether a URI ends in a given String.