All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.firefly.server.http2.router.utils.PathUtils Maven / Gradle / Ivy

There is a newer version: 5.0.0-dev6
Show newest version
package com.firefly.server.http2.router.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Pengtao Qiu
 */
abstract public class PathUtils {

    public static List split(String path) {
        List ret = new ArrayList<>();
        int start = 1;
        int max = path.length() - 1;

        for (int i = 1; i <= max; i++) {
            if (path.charAt(i) == '/') {
                ret.add(path.substring(start, i).trim());
                start = i + 1;
            }
        }

        if (path.charAt(max) != '/') {
            ret.add(path.substring(start).trim());
        }
        return ret;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy