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

io.github.kongweiguang.ok.core.Util Maven / Gradle / Ivy

package io.github.kongweiguang.ok.core;

import static java.util.Objects.isNull;

public final class Util {

  private Util() {
  }

  public static String replacePath(String path) {
    if (isNull(path)) {
      return "";
    }

    if (path.startsWith("/")) {
      path = path.replaceFirst("/", "");
    }
    return path;
  }

  public static String urlRegex(String url) {

    if (!url.startsWith(Const._http) && !url.startsWith(Const._https)) {
      if (url.startsWith("/")) {
        url = Const._http + Const.localhost + url;
      } else {
        url = Const._http + url;
      }
    }

    return url;
  }

  public static void sleep(long millis) {
    try {
      Thread.sleep(millis);
    } catch (InterruptedException ignored) {

    }
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy