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 transName(String name) {
    name = name.substring(4);
    return name + "******";
}

From source file:Main.java

public static String convertToUtf(String xml, String utf) {
    return utf + xml.substring(xml.indexOf("?>") + 2);
}

From source file:Main.java

public static String strRightBack(String input, int chars) {
    return input.substring(input.length() - chars);
}

From source file:FileUtil.java

public static String getFileExtension(String fileName) {
    return fileName.substring(fileName.lastIndexOf('.') + 1);
}

From source file:Main.java

public static String fileExt(String url) {
    String ext = url.substring(url.lastIndexOf("."));
    if (ext.indexOf("?") > -1) {
        ext = ext.substring(0, ext.indexOf("?"));
    }//www. j  a  v  a 2  s  . c om
    if (ext.indexOf("%") > -1) {
        ext = ext.substring(0, ext.indexOf("%"));
    }
    return ext;
}

From source file:Main.java

public static String getExtension(String uri) {
    return uri.contains(".") ? uri.substring(uri.lastIndexOf(".") + 1) : "";
}

From source file:Main.java

public static String getMethodName(String field) {
    String methodName = field.substring(1);
    String upperCase = field.substring(0, 1).toUpperCase();
    methodName = "set" + upperCase + methodName;
    return methodName;
}

From source file:Main.java

public static String getFilteredFolderName(String display_name) {
    display_name = display_name.substring(display_name.lastIndexOf("/") + 1);
    display_name = display_name.substring(display_name.lastIndexOf(".") + 1);
    return display_name;
}

From source file:Main.java

/**
 * Get the file extension of the file so data type can be identified
 * @param url the url of the file address
 * @return the file extension/* ww w .  j  a va 2s  .c o  m*/
 */
public static String getFileExtension(String url) {
    String extension = url.substring(url.lastIndexOf(".") + 1);
    extension = extension.toLowerCase();
    return extension;
}

From source file:Main.java

public static String trimFirstChar(String s) {
    return s.length() > 1 ? s.substring(1) : "";
}