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, int endIndex) 

Source Link

Document

Returns a string that is a substring of this string.

Usage

From source file:Main.java

public static String getShortTimeStr(String time) {

    String t = time.substring(11, time.length() - 3);
    String date = time.substring(8, 10);
    String month = time.substring(5, 7);

    return month + "/" + date + " " + t;
}

From source file:Main.java

public static String GetUpPath(String path) {
    String retPath = path.substring(0, path.lastIndexOf(File.separator));
    return retPath;

}

From source file:Main.java

public static String Cut(String num) {
    String cuttedString = num.substring(0, 5);
    return cuttedString;
}

From source file:Main.java

public static final String getPrefix(@NonNull String fileName) {
    return fileName.substring(0, fileName.lastIndexOf("."));
}

From source file:Main.java

public static int[] toIntArray(String string) {
    string = string.substring(1, string.length() - 1);
    String[] strings = string.split(", ");
    int[] intArray = new int[strings.length];
    for (int i = 0; i < strings.length; i++) {
        intArray[i] = Integer.parseInt(strings[i]);
    }/*from  w  w w .j av a2s  . c  o  m*/
    return intArray;
}

From source file:Main.java

public static String parseDate(String date) {
    String year = date.substring(0, 4);
    String month = date.substring(5, 7);
    String day = date.substring(8, 10);

    String newDate = day + "/" + month + "/" + year;
    return newDate;
}

From source file:Main.java

private static String getHash(String s) {
    String next = s.substring(s.lastIndexOf("/"), s.length());
    if (next.length() < 5) {
        return getHash(s.replace(next, ""));
    } else {//w  ww . j av  a2s. co m
        return next;
    }

}

From source file:Main.java

public static String firstToUpper(String string) {
    return string.substring(0, 1).toUpperCase() + string.substring(1);
}

From source file:Main.java

public static int converToDecimalFromHex(String s) {
    return Color.rgb(cH(s.substring(1, 3)), cH(s.substring(3, 5)), cH(s.substring(5, 7)));
}

From source file:com.talkingdata.orm.tool.ClassUtils.java

public static String lowerFirst(String name) {
    return name.substring(0, 1).toLowerCase() + name.substring(1);
}