Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*-----------------------------------------------------------------------
 * Copyright (C) 2001 Green Light District Team, Utrecht University 
 *
 * This program (Green Light District) is free software.
 * You may redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by
 * the Free Software Foundation (version 2 or later).
 *
 * This program 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.
 * See the documentation of Green Light District for further information.
 *------------------------------------------------------------------------*/

public class Main {
    /**
     * Takes the last name of a full XML tag name. If it consists of a generic
     * part and a specific part, then the generic part is removed. examples :
     * "model.infrastructure.node-edge" becomes "edge" : "model.infrastructure'
     * becomes "infrastructure"
     *
     * @param fullName The full XML tag name to convert
     * @return The result
     */
    public static String getSpecificLastName(String fullName) {
        int beginIndex = Math.max(Math.max(fullName.lastIndexOf('.'), fullName.lastIndexOf('-')), 0) + 1;
        return fullName.substring(beginIndex, fullName.length());
    }
}