Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String insideTopLevel(String xpath) {
        boolean alreadyInsideTopLevel = xpath.matches("^[(]*[//]+.*");

        final String prefix = (alreadyInsideTopLevel) ? "" : (xpath.startsWith("(")) ? "(//" : "//";
        final int chopn = (xpath.startsWith("(") && !alreadyInsideTopLevel) ? 1 : 0;
        return prefix + xpath.substring(chopn);
    }
}