Here you can find the source of extractClassName(final String classPath)
Parameter | Description |
---|---|
classPath | the whole class path |
public static String extractClassName(final String classPath)
//package com.java2s; /*/*from www . ja v a2s . c om*/ * Copyright 2012 Igor Maznitsa (http://www.igormaznitsa.com) * * This file is part of the JVM to Z80 translator project (hereinafter referred to as J2Z80). * * J2Z80 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. * * J2Z80 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 J2Z80. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Extract the class name from the whole class path * @param classPath the whole class path * @return the extracted class name */ public static String extractClassName(final String classPath) { int index = classPath.lastIndexOf('/'); if (index < 0) { index = classPath.lastIndexOf('.'); } if (index >= 0) { return classPath.substring(index + 1); } return classPath; } }