Remove Last Path Seperator from Uri - Android Network

Android examples for Network:Uri

Description

Remove Last Path Seperator from Uri

Demo Code

/*/* w  w  w . java2  s.  c o m*/
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 2012, Chun Xu, zuojisi@gmail.com
 *
 * This file is part of SimpleWebServer.
 * 
 * SimpleWebServer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * SimpleWebServer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with SimpleWebServer.  If not, see <http://www.gnu.org/licenses/>.
 *
 * - Author: Chun Xu
 * - Contact: zuojisi@gmail.com
 * - License: GNU Lesser General Public License (LGPL)
 * - Blog and source code availability: http://sws.pupfly.com/
 */
//package com.java2s;

public class Main {
    public static String RemoveLastPathSeperator(String uri) {
        if (uri.endsWith("/")) {
            return uri.substring(0, uri.length() - 1);
        } else {
            return uri;
        }
    }
}

Related Tutorials