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:Utils.java

public static String nonPackageQualifiedName(final Class<?> clazz) {

    String name = clazz.getName();
    return name.substring(name.lastIndexOf('.') + 1);
}

From source file:Main.java

public static CompressFormat GetCompressFormat(String name) {
    String extend = name.substring(name.lastIndexOf(".") + 1).toLowerCase();
    if (extend.equals("png")) {
        return CompressFormat.PNG;
    }//from w ww  .  j  ava  2s. co  m
    return CompressFormat.JPEG;
}

From source file:Util.java

public static String getUnqualifiedName(Class<?> clazz) {
    if (clazz == null)
        return "";
    String name = clazz.getName();
    return (name.substring(name.lastIndexOf('.') + 1));
}

From source file:Main.java

/**
 * get the last part of the zk-path//from   w  ww  .j av  a 2s .  c o  m
 * @param path
 * @return
 */
public static String getZkName(String path) {
    return path.substring(path.lastIndexOf('/') + 1);
}

From source file:Main.java

public static String strRightBack(String input, String delimiter) {
    return input.substring(input.lastIndexOf(delimiter) + delimiter.length());
}

From source file:Main.java

public static String getHour(String Hour) {
    String str = Hour;
    String weatherHour = str.substring(10);
    return weatherHour;
}

From source file:Main.java

@SuppressWarnings("unused")
public static String getFileExtension(String path) {
    return path == null ? null : path.substring(path.lastIndexOf(".") + 1);
}

From source file:Main.java

public static int[] getNativeColor(String colorString) {
    String color = colorString.substring(1);
    int[] ret = new int[3];
    for (int i = 0; i < 3; i++) {
        ret[i] = Integer.parseInt(color.substring(i * 2, i * 2 + 2), 16);
    }// w  w w  . j av  a  2s.  c om
    return ret;
}

From source file:Main.java

public static String getResourceId(String resourcePath) {
    return resourcePath.substring(resourcePath.lastIndexOf('/') + 1);
}

From source file:Main.java

/**
 * 1a:fe:34:77:c0:00 and 18:fe:34:77:c0:00 are the same BSSID whether the two BSSID is the same ignore the first
 * //from ww  w .  j  a  va2s. c o m
 * @param BSSID1
 * @param BSSID2
 * @return
 */
public static boolean isEqualIgnore2chars(String BSSID1, String BSSID2) {
    return (BSSID1.substring(3).equals(BSSID2.substring(3)));
}