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:com.roche.iceboar.downloader.FileUtilsFacade.java

public static String extractFilenameFromURL(String url) {
    if (url.contains("/")) {
        return url.substring(url.lastIndexOf('/') + 1, url.length());
    }/*from  w w  w .ja  v a  2s.c om*/
    return url;
}

From source file:Main.java

public static String getValueFormURL(String url, String key) {
    key += "=";//  ww w. j  a  v  a  2  s  .c  o  m
    if (url.contains(key)) {
        int aid = url.indexOf(key) + key.length();
        if (url.indexOf("&", aid) != -1) {
            return url.substring(aid, url.indexOf("&", aid));
        } else {
            return url.substring(aid, url.length());
        }
    } else {
        return null;
    }
}

From source file:Main.java

public static String[] parse(String str) {
    String[] strs = new String[2];
    if (str.contains("|")) {
        strs[0] = str.substring(0, str.indexOf("|"));
        strs[1] = str.substring(str.indexOf("|") + 1, str.length());
    } else {//w ww .j av a 2 s  .  com
        strs[0] = str;
        strs[1] = str;
    }
    return strs;
}

From source file:Main.java

private static boolean checkRootMethod1() {
    String buildTags = android.os.Build.TAGS;
    return buildTags != null && buildTags.contains("test-keys");
}

From source file:Main.java

private static boolean isInvalidOrigin(String origin) {
    if (origin.isEmpty() || origin.contains("%")) {
        return true;
    }/*  w  w w.jav  a  2  s.  c  om*/
    try {
        return new URI(origin).getScheme() == null;
    } catch (URISyntaxException e) {
        return true;
    }
}

From source file:Main.java

public static String[] sepPath(String filePath) {
    if (filePath == null || !filePath.contains("/") || (filePath.lastIndexOf("/") == (filePath.length() - 1))) {
        return null;
    }//from   w w  w  .j  ava 2  s  .  c o m
    int index = filePath.lastIndexOf("/") + 1;
    String[] arr = new String[2];
    arr[0] = filePath.substring(0, index);
    arr[1] = filePath.substring(index);
    return arr;
}

From source file:Main.java

/**
 * Removes leading XML declaration from xml if present.
 * @param xml/*  ww  w  .  j ava2s.  co m*/
 * @return
 */
public static String omitXmlDeclaration(String xml) {
    if (xml.startsWith("<?xml") && xml.contains("?>")) {
        return xml.substring(xml.indexOf("?>") + 2).trim();
    }

    return xml;
}

From source file:Main.java

public static boolean isOnlineVideo(Uri uri) {
    if (uri == null) {
        return false;
    }/*from  w w  w  .j a v  a 2 s  . com*/
    String scheme = uri.getScheme();
    if (scheme != null && (scheme.equals("http") || scheme.equals("https") || scheme.equals("rtsp"))) {
        return true;
    }
    String path = uri.toString();
    if (path != null && path.contains("app_smb")) {
        return true;
    }
    return false;
}

From source file:Main.java

public static boolean isHtml(String str) {
    if (!TextUtils.isEmpty(str)) {
        return str.contains("<html");
    }/*from   ww w. j a v a2  s .  c  o  m*/
    return false;
}

From source file:Main.java

private static boolean isIPCIDR(final String hostRange) {
    boolean result = false;

    if (hostRange.contains("/")) {
        result = true;//from   w ww .  j  a  va  2s  .c o  m
    }

    return result;
}