Example usage for java.lang String endsWith

List of usage examples for java.lang String endsWith

Introduction

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

Prototype

public boolean endsWith(String suffix) 

Source Link

Document

Tests if this string ends with the specified suffix.

Usage

From source file:Main.java

public static boolean isAudio(String url) {
    return url.endsWith(".mp3") || url.endsWith(".ogg") || url.endsWith(".m3u") || url.endsWith(".wav");
}

From source file:Main.java

public static boolean isPicture(String fileName) {
    if (fileName.endsWith(".png") || fileName.endsWith(".jpg") || fileName.endsWith(".bmp")
            || fileName.endsWith(".jpeg") || fileName.endsWith(".gif")) {
        return true;
    } else {/*w  ww .  java 2  s . co  m*/
        return false;
    }

}

From source file:Main.java

public static boolean isStarredUid(final String uid) {
    return uid.endsWith("/state/com.google/starred");
}

From source file:Main.java

public static boolean isReadingListUid(final String uid) {
    return uid.endsWith("/state/com.google/reading-list");
}

From source file:Main.java

public static boolean isReadUid(final String uid) {
    return uid.endsWith("/state/com.google/read");
}

From source file:Main.java

public static boolean isDoc(String url) {
    return url.endsWith(".pdf") || url.endsWith(".ppt") || url.endsWith(".doc") || url.endsWith(".swf")
            || url.endsWith(".rtf") || url.endsWith(".xls");
}

From source file:Main.java

public static boolean isVideo(String url) {
    return url.endsWith(".mpeg") || url.endsWith(".mpg") || url.endsWith(".avi") || url.endsWith(".mov")
            || url.endsWith(".mpg4") || url.endsWith(".mp4") || url.endsWith(".flv") || url.endsWith(".wmv");
}

From source file:Main.java

public static boolean isImage(String url) {
    return url.endsWith(".png") || url.endsWith(".jpeg") || url.endsWith(".gif") || url.endsWith(".jpg")
            || url.endsWith(".bmp") || url.endsWith(".ico") || url.endsWith(".eps");
}

From source file:Main.java

public static boolean isPackage(String url) {
    return url.endsWith(".gz") || url.endsWith(".tgz") || url.endsWith(".zip") || url.endsWith(".rar")
            || url.endsWith(".deb") || url.endsWith(".rpm") || url.endsWith(".7z");
}

From source file:Main.java

public static String stripTrailingSlash(String s) {
    if (s.endsWith("/") && s.length() > 1)
        return s.substring(0, s.length() - 1);
    return s;/*from w ww.  j  av  a2s.co m*/
}