Here you can find the source of getFileName(String s)
Parameter | Description |
---|---|
ss | a parameter |
public static String getFileName(String s)
//package com.java2s; /**/*w w w.j ava2 s . c o m*/ * Copyright 2011 The ARIES Consortium (http://www.ariesonline.org) and * www.integratedmodelling.org. This file is part of Thinklab. Thinklab is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Thinklab 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 General Public License for more details. You should have received a copy of the GNU General Public License along with Thinklab. If not, see <http://www.gnu.org/licenses/>. */ import java.io.File; public class Main { /** * Return file name with no path but with extension * @param ss * @return */ public static String getFileName(String s) { String ret = s; int sl = ret.lastIndexOf(File.separator); if (sl < 0) sl = ret.lastIndexOf('/'); if (sl > 0) ret = ret.substring(sl + 1); return ret; } }