Example usage for java.lang String substring

List of usage examples for java.lang String substring

Introduction

In this page you can find the example usage for java.lang String substring.

Prototype

public String substring(int beginIndex) 

Source Link

Document

Returns a string that is a substring of this string.

Usage

From source file:Main.java

public static String getExtension(String inputString) {
    return inputString.substring(inputString.lastIndexOf(".") + 1);
}

From source file:Main.java

public static String b64FileName(String fn) {
    String fln = fn.substring(fn.lastIndexOf('/') + 1);
    fln = fln.substring(0, fln.indexOf('.'));
    return fln + B64EX;
}

From source file:Main.java

public static String getMethodName(String classMethodName) {
    return classMethodName.substring(classMethodName.indexOf('#') + 1);
}

From source file:Main.java

public static void latencyLog(String data) {
    data = data.substring(data.indexOf("time-") + 5);
    long started = Long.parseLong(data);
    long current = System.currentTimeMillis();
    Log.i("Latency", String.valueOf(current - started));

}

From source file:Main.java

public static String getFileExtension(String url) {
    String extension = url.substring(url.lastIndexOf(".") + 1);
    return extension;
}

From source file:Main.java

public static String getFileName(String path) {
    String fileName = path.substring(path.lastIndexOf("/") + 1);
    return fileName;
}

From source file:Main.java

public static boolean fileIsJpeg(String fn) {
    String suff = fn.substring(fn.lastIndexOf('.') + 1).toLowerCase();
    if (" .jpeg .jpg".indexOf(suff) > 0)
        return true;
    else/*from  w  w  w . j  a  va  2  s  .co  m*/
        return false;
}

From source file:Main.java

public static boolean fileIsImage(String fn) {
    String suff = fn.substring(fn.lastIndexOf('.') + 1).toLowerCase();
    if (" .jpeg .bmp .jpg .png .gif".indexOf(suff) > 0)
        return true;
    else/*www  .  j av a 2  s.  c o m*/
        return false;
}

From source file:Main.java

public static String authorIdFromProfileUrl(String uploaderProfileUrl) {
    return uploaderProfileUrl.substring(17);
}

From source file:Main.java

public static Map<String, String> url2Map(String url) {
    url = url.substring(url.lastIndexOf("?") + 1);
    String[] params = url.split("&");
    Map<String, String> map = new HashMap<String, String>();
    for (String param : params) {
        map.put(param.split("=")[0], param.split("=")[1]);
    }/*  w w w .j  a  v a2 s. c  o m*/
    return map;
}