Here you can find the source of baseName(String name)
public static String baseName(String name)
//package com.java2s; /*//from w w w . j a v a2 s . c o m * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { /** * Search for both slashes in order to support URLs and * files. */ public static String baseName(String name) { int index = name.lastIndexOf('\\'); if (index < 0) { index = name.lastIndexOf('/'); } if (index >= 0) return name.substring(index + 1); else { int lastColonIndex = name.lastIndexOf(':'); if (lastColonIndex > 0) return name.substring(lastColonIndex + 1); else return name; } } }