Example usage for java.lang String contains

List of usage examples for java.lang String contains

Introduction

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

Prototype

public boolean contains(CharSequence s) 

Source Link

Document

Returns true if and only if this string contains the specified sequence of char values.

Usage

From source file:Main.java

public static int isSupportedVersion(int versioncode, String versionName) {
    if (versionName.contains("6.2.0.50")) {
        return 0;
    } else if (versionName.contains("6.2.2.54")) {
        return 1;
    } else if (versionName.contains("6.2.4.49")) {
        return 2;
    } else if (versionName.contains("6.2.4.51")) {
        return 3;
    } else if (versionName.contains("6.2.5.49")) {
        return 4;
    } else if (versionName.contains("6.2.5.51")) {
        return 4;
    } else if (versionName.contains("6.2.5.52")) {
        return 4;
    } else {// www  . j  a  v  a 2 s .  c om
        return -1;
    }
}

From source file:Main.java

/**
 * Parses a unique id into the ABI and name.
 * @param id The id to parse.//from  ww  w.ja v a  2  s .  c om
 * @return a string array containing the ABI and name.
 */
public static String[] parseId(String id) {
    if (id == null || !id.contains(" ")) {
        return new String[] { "", "" };
    }
    return id.split(" ");
}

From source file:Main.java

public static ArrayList<Integer> getArrayList(String aggregate) {
    if (aggregate.equals(""))
        return null;
    ArrayList<Integer> list = new ArrayList<Integer>();
    String[] tokens = aggregate.split(",");

    for (String t : tokens) {
        if (t.contains("-")) {
            String[] indices = t.split("-");
            for (int i = Integer.parseInt(indices[0]); i <= Integer.parseInt(indices[1]); i++)
                list.add(i);//from  w  w  w  . j  ava 2s. co m
        } else {
            list.add(Integer.parseInt(t));
        }
    }
    return list;
}

From source file:Main.java

public static File getInternalFileObject(String uri, Context context) {
    if (!uri.contains(File.pathSeparator)) {
        return new File(context.getFilesDir(), uri);
    }/*from w w w .j a  v  a 2s .  com*/
    return null;
}

From source file:Main.java

public static String getPathToFirstList(String attributePath) {
    if (attributePath != null && attributePath.contains("[")) { //$NON-NLS-1$
        return attributePath.substring(0, attributePath.indexOf("["));
    } else {/*from w w w.j a va2s.com*/
        return null;
    }
}

From source file:Main.java

private static File getCachImage(final String id, File cachDir) {
    File[] list = cachDir.listFiles(new FilenameFilter() {

        @Override/*from   ww  w  .j av a  2  s .c  o  m*/
        public boolean accept(File dir, String filename) {
            return filename.contains(id);
        }
    });
    if (list != null && list.length != 0) {
        return list[0];
    } else {
        return null;
    }
}

From source file:Main.java

public static int getIntPref(Context context, String key) {
    int i = 0;/* w  ww. j ava  2  s.c  o m*/
    if (key.contains("picker")) {
        int intColor = context.getSharedPreferences(THEME_PREFS, 0).getInt(key, Color.WHITE);
        i = intColor;
    }
    return i;
}

From source file:Main.java

public static String extractIntentName(String exString) {
    if (!exString.contains(LEFT_PARENTHESIS)) {
        if (exString.contains(RIGHT_PARENTHESIS)) {
            return exString.substring(0, exString.indexOf(RIGHT_PARENTHESIS)).trim();
        } else {// ww  w  .  jav a  2  s  .  c om
            return exString;
        }
    }

    int leftParIndex = exString.indexOf(LEFT_PARENTHESIS);
    return exString.substring(0, leftParIndex).trim();
}

From source file:Main.java

public static int parserString2TimeStamp(String str) {
    int totalSec = 0;
    if (str.contains(":")) {
        String[] my = str.split(":");
        int hour = Integer.parseInt(my[0]);
        int min = Integer.parseInt(my[1]);
        int sec = Integer.parseInt(my[2]);
        totalSec = hour * 3600 + min * 60 + sec;
        totalSec = totalSec * 1000;/*w  w  w .  ja v  a  2  s .com*/
    }
    return totalSec;
}

From source file:Main.java

public static boolean isAndroid(String vmName) {
    String lowerVMName = vmName.toLowerCase();

    return lowerVMName.contains("dalvik") //
            || lowerVMName.contains("lemur") // aliyun-vm name
    ;//  w  w w  .j  a  v  a2  s  . c  o  m
}