Example usage for java.lang String lastIndexOf

List of usage examples for java.lang String lastIndexOf

Introduction

In this page you can find the example usage for java.lang String lastIndexOf.

Prototype

public int lastIndexOf(String str) 

Source Link

Document

Returns the index within this string of the last occurrence of the specified substring.

Usage

From source file:Main.java

public static boolean fileIsJpeg(String fn) {
    String suff = fn.substring(fn.lastIndexOf('.') + 1).toLowerCase();
    if (" .jpeg .jpg".indexOf(suff) > 0)
        return true;
    else//from   w w  w  .j  a  v  a 2 s. c  om
        return false;
}

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 getFileNameWithoutExtension(String fileName) {
    return fileName.substring(0, fileName.lastIndexOf("."));
}

From source file:Main.java

public static boolean fileIsImage(String fn) {
    String suff = fn.substring(fn.lastIndexOf('.') + 1).toLowerCase();
    if (" .jpeg .bmp .jpg .png .gif".indexOf(suff) > 0)
        return true;
    else/*from w  w w  .j a v  a 2 s  .  c  om*/
        return false;
}

From source file:Main.java

public static String stripPackageFromClassName(String className) {
    return className.substring(className.lastIndexOf(".") + 1);
}

From source file:Main.java

public static String getFileExtension(String url) {
    String extension = url.substring(url.lastIndexOf(".") + 1);
    return extension;
}

From source file:Main.java

public static String getFileExtension(String file) {
    return file.substring(file.lastIndexOf(".") + 1, file.length());

}

From source file:Main.java

public static String getFileName(String url) {
    return TextUtils.substring(url, url.lastIndexOf("/"), url.length());
}

From source file:Main.java

public static String getSubClientId(String fullClientId, String posId) {
    int pos = fullClientId.lastIndexOf(posId);
    return fullClientId.substring(0, pos) + posId;
}

From source file:Main.java

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