Here you can find the source of basename(String name, String split)
Parameter | Description |
---|---|
name | String |
split | String |
public static String basename(String name, String split)
//package com.java2s; /**//from w w w .ja va2 s . c om * Copyright 2010 ZTEsoft Inc. All Rights Reserved. * * This software is the proprietary information of ZTEsoft Inc. * Use is subject to license terms. * * $Tracker List * * $TaskId: $ $Date: 9:24:36 AM (May 9, 2008) $comments: create * $TaskId: $ $Date: 3:56:36 PM (SEP 13, 2010) $comments: upgrade jvm to jvm1.5 * * */ public class Main { /** * return String basename * * @param name * String * @param split * String * @return String com.ztesoft.ispp.ne --> ne */ public static String basename(String name, String split) { if (name == null || name.equals("")) { return ""; } if (split == null || split.equals("")) { split = "."; } int index = name.lastIndexOf(split); if (index >= 0) { return name.substring(index + split.length()); } return name; } }