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 String getKmlSimpleFileName(File file) {
    String fileName = file.getName();
    if (fileName.endsWith(KML_FILE_ENDS)) {
        return fileName.substring(0, fileName.length() - KML_FILE_ENDS.length());
    } else {/*w  ww.ja  v  a2s . co m*/
        return fileName;
    }
}

From source file:Main.java

public static String removeSuffix(String str, String suffix) {
    if (str != null && str.endsWith(suffix)) {
        return str.substring(0, str.length() - suffix.length());
    }/*from w  ww  . java  2 s. co  m*/
    return str;
}

From source file:Main.java

public static String unescapeQuotes(String value) {
    if (value.startsWith("\\\"") && value.endsWith("\\\"")) {
        return value.substring(2, value.length() - 2);
    }//w ww.  j  a  v  a  2s  .c o m
    return value;
}

From source file:Main.java

public static boolean endsWith(String line, String s) {
    return line.endsWith(s);
}

From source file:Main.java

public static boolean isZh(Context context) {
    Locale locale = context.getResources().getConfiguration().locale;
    String language = locale.getLanguage();
    return language.endsWith("zh");
}

From source file:Main.java

public static boolean isImageUri(String s1) {
    s1 = s1.toLowerCase();/*from   ww  w.j a  v a  2s .  c o  m*/
    return s1.endsWith(".png") || s1.endsWith(".jpg") || s1.endsWith(".jpeg") || s1.endsWith(".bmp")
            || s1.endsWith(".gif");
}

From source file:Main.java

public static boolean isMucId(String mucId) {
    return !TextUtils.isEmpty(mucId) && mucId.endsWith(".muc");
}

From source file:Main.java

public static boolean isMucIdLegal(String mucId) {
    return !TextUtils.isEmpty(mucId) && mucId.endsWith(MUC_TAIL);
}

From source file:Main.java

public static void saveFile(Bitmap bm, String path, String fileName) throws IOException {
    String uri = path;
    if (!uri.endsWith("/")) {
        uri = uri + "/";
    }//from  w  ww. j a v  a  2s .c  o  m
    uri = uri + fileName;
    File dirFile = new File(path);
    if (!dirFile.exists()) {
        dirFile.mkdir();
    }
    File myCaptureFile = new File(uri);
    BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
    bm.compress(Bitmap.CompressFormat.JPEG, 80, bos);
    bos.flush();
    bos.close();
    // SharedPreferences sp=
}

From source file:Main.java

public static CompressFormat getFormat(String url) {
    String fileName = getName(url);
    if (fileName.endsWith("png")) {
        return CompressFormat.PNG;
    }/*  w  w w  .j  a  va 2 s . c om*/
    return CompressFormat.JPEG;
}