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

/**
 * Returns is there a "!?" or a "?!" in a sentece.
 * //from   w w  w.j  ava 2s.c  o m
 * @param text {@link String} representing the sentence 
 * @return boolean representing the existance of a "!?" or a "?!" 
 */
public static boolean hasExclaminationQuestionMarks(String text) {
    if ((text.contains("?!")) || (text.contains("!?")))
        return true;
    return false;
}

From source file:Main.java

/** 
 * convert a string with a decimal and a unit such as "5.5 knots"
 * to -> " . 5 knots 5 . " //  w  w  w .  j  a va 2  s  . co m
 * **/
public static String decimal2Sequence(String value, String unit) {
    if (value.contains(".")) {
        int PointIndex = value.indexOf(".");
        String intVal = value.substring(0, PointIndex);
        String decimal = value.substring(PointIndex + 1, PointIndex + 2);
        value = " . " + intVal + " " + unit + " " + decimal + " . ";
    }
    return value;
}

From source file:Main.java

public static boolean isCampaignStopped(String status, Date endDate) {
    return status.contains("STOPPED") || isCampaignExpired(endDate);
}

From source file:Main.java

/**
 * workaround for http://groups.google.com/group/google-translate-general/browse_thread/thread/8cdc2b71f5213cf7
 *///www.j a v  a  2s.c o  m
private static String workAroundBefore(String origText) {
    if (origText.contains("# ") || origText.contains("@ "))
        return origText;
    else
        // use letters so that google thinks the word after the '#' is related to those letters and won't translate or mix it up.
        return origText.replaceAll("#", "XbllsHYBoPll").replaceAll("@", "XallsHYBoPll");
}

From source file:Main.java

public static boolean isPath(String path) {
    if (path.contains(separator) || path.contains("\\")) {
        return true;
    }/*  w  w  w .  j  a v  a2  s . c om*/
    return false;
}

From source file:Main.java

public static boolean isCommand(ArrayList<String> textMatchList) {
    for (String word : textMatchList) {
        if (word.contains("coach"))
            return true;
    }//w  ww  .j ava  2 s.com
    return false;
}

From source file:Main.java

public static String lastIdentifier(String s) {
    if (s.contains("."))
        return s.substring(s.lastIndexOf(".") + 1);
    else//  w  w  w .j a  v a 2s.com
        return s;
}

From source file:Main.java

public static String xpathEscapeColon(String nameToEscape) {
    if (nameToEscape.contains(":"))
        return "*[name()=\"" + nameToEscape + "\"]";
    return nameToEscape;
}

From source file:Main.java

public static String createUri(final String path) {
    if (path.contains(":/")) {
        return path;
    }/*  w  ww  .  j a  v a2 s . c o  m*/

    try {
        return DUMMY_PREFIX + URLEncoder.encode(path, "UTF-8");
    } catch (final UnsupportedEncodingException e) {
        throw new AssertionError(e);
    }
}

From source file:Main.java

private static void checkBaseDirValue(String baseDir) {
    if (baseDir.contains("/../")) {
        throw new IllegalArgumentException(ANDROID_BASE_DIR + " can't have \"..\" symbols");
    }//from w  w  w  . j  av  a 2  s  .  co  m

    if (baseDir.startsWith("../")) {
        throw new IllegalArgumentException(ANDROID_BASE_DIR + " can't starts with ..\" symbol");
    }

    if (baseDir.contains("/./")) {
        throw new IllegalArgumentException(ANDROID_BASE_DIR + " can't have \".\" symbols");
    }

    if (baseDir.contains("/./")) {
        throw new IllegalArgumentException(ANDROID_BASE_DIR + " can't have \".\" symbols");
    }
}