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 getIdNameFromId(String pId) {
        if (pId.startsWith("@+id/")) {
            return pId.substring(5);
        } else if (pId.startsWith("@id/")) {
            return pId.substring(4);
        }
        throw new IllegalArgumentException("Wrong id structure: " + pId);
    }
}