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

/**
 * @param doc/*from  w  w  w.  j  av  a  2s.  c  om*/
 * @param fragId
 * @return
 */
public static Element resolveDitaFragmentId(Document doc, String fragId) {
    String topicId = null;
    String elemId = null;
    if (fragId.contains("/")) {
        String[] parts = fragId.split("/");
        topicId = parts[0];
        elemId = parts[1];
    } else {
        topicId = fragId;
    }
    // FIXME: Use xpaths to resolve the IDs as appropriate
    throw new NotImplementedException();
}

From source file:com.aliyun.openservices.odps.console.ODPSConsole.java

private static void checkSDKEnviron() {
    String classpath = System.getProperty("java.class.path");
    String[] classpathEntries = classpath.split(File.pathSeparator);
    long count = 0L;
    for (String line : classpathEntries) {
        if (line.contains("odps-sdk-core") && (!line.contains("odps-sdk-core-internal"))) {
            ++count;// ww w .j a va  2s .c  o m
        }
    }
    if (count > 1) {
        System.err.println(
                "WARNING: detected sdk conflict in console lib folder. Please install console in a fresh new folder.");
    }
}

From source file:Main.java

/**
 * Method perform intelligent escaping of quotes in xpath expressions, if necessary it constructs concat
 * functions otherwise it simply add single or double quotes.
 *
 * @param sentence - e.g. "'My Login' te"xt" then result: concat("'", 'My Login', "'", ' te"xt')
 * @return sentence with quotes or concat function
 * @throws NullPointerException if sentence is null
 *//*from  www .ja v a 2  s  .co m*/
public static String quote(String sentence) {
    if (!sentence.contains("'")) {
        return addSingleQuotation(sentence);
    } else if (sentence.contains("'") && !sentence.contains("\"")) {
        return addDoubleQuotation(sentence);
    } else {
        return changeToConcat(sentence);
    }
}

From source file:Main.java

public static String replaceSpaces(String url) {
    if (!url.isEmpty()) {
        url = url.trim();/*  www. j a  v  a2s .c o  m*/
        if (url.contains(" ")) {
            Matcher spaces = SPACE.matcher(url);
            url = spaces.replaceAll("%20");
        }
    }
    return url;
}

From source file:net.shibboleth.idp.oidc.client.userinfo.authn.AuthenticationMethodRefAuthority.java

/**
 * Gets authentication class ref authority.
 *
 * @param authority the authority/*  w w w .  j  a v  a2s.  com*/
 * @return the authentication class ref authority
 */
public static AuthenticationMethodRefAuthority getAuthenticationClassRefAuthority(
        final GrantedAuthority authority) {
    final String typeAndRole = authority.toString();
    if (typeAndRole.contains(AuthenticationMethodRefAuthority.class.getSimpleName())) {
        final String role = typeAndRole.split(",")[1];
        return new AuthenticationMethodRefAuthority(role);
    }
    return null;
}

From source file:edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectorUtilities.java

/**
 * Look in the current theme directory to find a selection image for this
 * Locale.//from  w  ww. j  a v  a 2  s .c  om
 * 
 * Images are expected at a resource path like
 * /[themeDir]/i18n/images/select_locale_[locale_code].*
 * 
 * For example, /themes/wilma/i18n/images/select_locale_en.png
 * /themes/wilma/i18n/images/select_locale_en.JPEG
 * /themes/wilma/i18n/images/select_locale_en.gif
 * 
 * To create a proper URL, prepend the context path.
 */
public static String getImageUrl(VitroRequest vreq, Locale locale) throws FileNotFoundException {
    String filename = "select_locale_" + locale + ".";

    String themeDir = vreq.getAppBean().getThemeDir();
    String imageDirPath = "/" + themeDir + "i18n/images/";

    ServletContext ctx = vreq.getSession().getServletContext();
    @SuppressWarnings("unchecked")
    Set<String> resourcePaths = ctx.getResourcePaths(imageDirPath);
    if (resourcePaths != null) {
        for (String resourcePath : resourcePaths) {
            if (resourcePath.contains(filename)) {
                String fullPath = vreq.getContextPath() + resourcePath;
                log.debug("Found image for " + locale + " at '" + fullPath + "'");
                return fullPath;
            }
        }
    }
    throw new FileNotFoundException("Can't find an image for " + locale);
}

From source file:net.shibboleth.idp.oidc.client.userinfo.authn.AuthenticationClassRefAuthority.java

/**
 * Gets authentication class ref authority.
 *
 * @param authority the authority/*from  w ww.  j  a v a 2 s.com*/
 * @return the authentication class ref authority
 */
public static AuthenticationClassRefAuthority getAuthenticationClassRefAuthority(
        final GrantedAuthority authority) {
    final String typeAndRole = authority.toString();
    if (typeAndRole.contains(AuthenticationClassRefAuthority.class.getSimpleName())) {
        final String role = typeAndRole.split(",")[1];
        return new AuthenticationClassRefAuthority(role);
    }
    return null;
}

From source file:Main.java

public static boolean contains(final String label, final String text) {
    if (label == null) {
        return false;
    }/*w ww . j a v a2 s. c om*/
    return label.contains(text);
}

From source file:io.fabric8.karaf.core.Support.java

/**
 * Returns the string after the given token
 *
 * @param text  the text// www.  ja v a 2 s  . com
 * @param after the token
 * @return the text after the token, or <tt>null</tt> if text does not contain the token
 */
public static String after(String text, String after) {
    if (!text.contains(after)) {
        return null;
    }
    return text.substring(text.indexOf(after) + after.length());
}

From source file:Main.java

public static boolean isX86CPU() {
    String cpu = getCpuInfo();
    if (!TextUtils.isEmpty(cpu)) {
        if (cpu.contains("x86")) {
            return true;
        }/*from  w w w.  j av  a 2s.c  o  m*/
    }
    return false;
}