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 String getInnerCondition(String in) {
    if (in.contains("[")) {
        return in.substring(in.lastIndexOf("=\'") + 2, in.lastIndexOf("'"));

    } else {/*  w ww  .  j av  a2  s.  com*/
        return in.substring(in.lastIndexOf("/") + 1);
    }
}

From source file:Main.java

public static String getValidUrl(String url) {
    if (!url.contains("http://"))
        url = "http://" + url;
    if (url.substring(url.length() - 1).equals("/"))
        url = url.substring(0, url.length() - 1);
    return url;//from  w  w w.  ja  v  a  2  s . c  o m
}

From source file:Main.java

public static boolean isValidURL(String url) {
    if (url.contains("http://") || url.contains("https://")) {
        if (url.contains(".")) {
            return true;
        }/*  w  ww  .j a  v a  2  s  .  c o m*/
    }
    return false;
}

From source file:Main.java

public static String sign(String url) {
    if (url.contains("?")) {
        return url + "&access_token=" + sToken;
    } else {//from   www. java  2 s  .  c  o  m
        return url + "?access_token=" + sToken;
    }
}

From source file:Main.java

public static String getProtocol(final String s) {
    if (!s.contains("://")) {
        return null;
    }/*from   w  ww  .ja v  a  2 s . c  om*/
    return s.split("://")[0];
}

From source file:Main.java

public static String removeHttpSuffix(String imgUrl) {
    if (imgUrl.contains("?")) {
        int tempIndex = imgUrl.indexOf("?");
        return imgUrl.substring(0, tempIndex + 1);
    }/*from w  w w  . j  a  v a  2  s.c  o  m*/
    return imgUrl;
}

From source file:Main.java

private static boolean isAskType(String sparqlQuery) {
    return sparqlQuery.contains("\nASK\n") || sparqlQuery.contains("ASK ");
}

From source file:Main.java

/**
 * checks whether the url is image url or not.
 * /* ww  w . ja  v  a  2  s  .  co m*/
 * @param url
 * @return boolean
 */
public static boolean isUrlImage(String url) {
    if (url.contains("png") || url.contains("jpeg") || url.contains("jpg"))
        return true;
    return false;
}

From source file:Main.java

/**
 * Packs name in `name` if name does not contain '`'
 * @param in name//  ww w  .j  a  va 2s.com
 * @return `name`
 */
public static String packDelim(String in) {
    if (in.contains(DELIM))
        return in;
    return DELIM + in + DELIM;
}

From source file:Main.java

public static boolean isZip(String s) {
    if (s.contains(".")) {
        String[] r = s.split("\\.");
        String ext = r[r.length - 1];
        if (ext.toUpperCase().equals("ZIP")) {
            return true;
        }//from  w  w w.j  av a2s . c  o  m
    }
    return false;
}