Here you can find the source of basename(final String name)
public static String basename(final String name)
//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; } } }