Java File Base Name Get basename(final String name)

Here you can find the source of basename(final String name)

Description

basename

License

Open Source License

Declaration

public static String basename(final String name) 

Method Source Code

//package com.java2s;
/******************************************************************************
 * Copyright (c) 2010 Oracle//  ww w. j  a  va 2  s .  c om
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Konstantin Komissarchik - initial implementation and ongoing maintenance
 ******************************************************************************/

public class Main {
    public static String basename(final String name) {
        final int colon = name.indexOf(':');

        if (colon != -1) {
            return name.substring(colon + 1);
        } else {
            return name;
        }
    }
}

Related

  1. baseName(String controllerName)
  2. baseName(String filename)
  3. baseName(String filename)
  4. baseName(String filename)