Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Split string to array of path array.
     * @param path  "/root/elementA/elementB"
     * @return
     */
    public static String[] toPathArray(String path) {
        if (path.charAt(0) == '/')
            path = path.substring(1);
        return path.split("/");
    }
}