Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String getTheName(String target) {
        if (target.length() < 3) //prevent crashing if the name is like 1 and I just want to edit it.
        {
            return target;
        }
        String possibleRemoval = target.substring(target.length() - 2);
        if (possibleRemoval.equalsIgnoreCase("-d") || possibleRemoval.equalsIgnoreCase("-s")
                || possibleRemoval.equalsIgnoreCase("-u") || possibleRemoval.equalsIgnoreCase("-a")
                || possibleRemoval.equalsIgnoreCase("-r") || possibleRemoval.equalsIgnoreCase("-n")) {
            return target.substring(0, target.length() - 3);
        }
        return target;
    }
}