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 getFileExtension(String file) {
    return file.substring(file.lastIndexOf(".") + 1, file.length());

}

From source file:Main.java

@SuppressWarnings("unused")
private static String getSuffix(String url) {
    String suffix = url.substring(url.lastIndexOf("/") + 1, url.length());
    return suffix;
}

From source file:Main.java

public static String getFileType(String path) {
    return path.substring(path.lastIndexOf(".") + 1, path.length());
}

From source file:Main.java

/**
 * from "myFunction(arg1,arg2)", return "myFunction"
 *//*from   w w  w  .  ja va 2s.com*/
public static String getFunctionName(String tag) {
    return tag.substring(0, tag.indexOf('(')).trim();
}

From source file:Main.java

public static String extractFilterCriteria(String selectedCriteria) {
    return (selectedCriteria.substring(0, selectedCriteria.lastIndexOf("("))).trim();
}

From source file:Main.java

public static String Stringinsert(String a, String b, int t) {
    return a.substring(0, t) + b + a.substring(t + 1, a.length());
}

From source file:Main.java

public static String getRawPath(String path) {
    String rawPath = path.substring(0, path.indexOf("_tn"));
    return rawPath;
}

From source file:Main.java

public static String getDir(String path) {
    String subString = path.substring(0, path.lastIndexOf('/'));
    return subString.substring(subString.lastIndexOf('/') + 1, subString.length());
}

From source file:Main.java

/**
 * Removes a <root> tag from around the given xml string.
 * //from   w ww .j a v  a  2 s  . c om
 * @param xmlWithRoot
 * @return
 */
public static String removeRootTag(String xmlWithRoot) {
    return xmlWithRoot.substring(6, xmlWithRoot.length() - 7);
}

From source file:Main.java

public final static String convertFristToUpperCase(String temp) {
    String frist = temp.substring(0, 1);
    String other = temp.substring(1);
    return frist.toUpperCase(Locale.getDefault()) + other;
}