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 int convertNameToColor(String name) {
    name = name.substring(0, name.lastIndexOf('.'));
    return Color.parseColor(name);
}

From source file:Main.java

public static String initStr(String old) {
    String str = old.substring(0, 1).toUpperCase() + old.substring(1);
    return str;
}

From source file:Main.java

public static String getArray(String arrNameFull) {
    return arrNameFull.substring(0, arrNameFull.indexOf("]") + 1);
}

From source file:Main.java

public static String getNameFromNameAddress(String nameAddress) {
    return nameAddress.substring(0, nameAddress.indexOf(" "));
}

From source file:Main.java

public static String getArrayName(String arrNameFull) {
    return arrNameFull.substring(0, arrNameFull.indexOf("["));
}

From source file:Main.java

/**
 * Extract root url from Capi header//from  w w  w.  j av  a2 s . co m
 * @param link
 * @return a String containing url
 */
private static String extractRootUrl(String link) {
    return link.substring(link.indexOf('<') + 1, link.indexOf('>'));
}

From source file:Main.java

public static String getKey(String downloadUrl) {
    return downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1, downloadUrl.lastIndexOf("."));
}

From source file:Main.java

public static String extractFileName(String fullFileName) {
    return fullFileName.substring(fullFileName.lastIndexOf("/") + 1, fullFileName.length());
}

From source file:Main.java

public static String Convert_User_ID_To_Phone(String User_ID) {
    if (User_ID.substring(0, 3).equals("972")) {
        User_ID = 0 + User_ID.substring(3);
        User_ID = User_ID.substring(0, 3) + "-" + User_ID.substring(3);
    }/*from www.ja  v  a  2s. com*/
    return User_ID;
}

From source file:Main.java

public static String getImgExt(final String imgLoc) {
    return imgLoc.substring(imgLoc.lastIndexOf("."), imgLoc.length());
}