Example usage for java.lang String startsWith

List of usage examples for java.lang String startsWith

Introduction

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

Prototype

public boolean startsWith(String prefix) 

Source Link

Document

Tests if this string starts with the specified prefix.

Usage

From source file:Main.java

private static boolean isMsgImg(String message) {
    return message.startsWith("<img alt=") || message.startsWith("<img title=");
}

From source file:Main.java

public static boolean isPropertyName(String name) {
    return name.startsWith(IS) || name.startsWith(GET) || name.startsWith(SET);
}

From source file:Main.java

public static boolean isLocaImange(String url) {
    if (url.startsWith("http://") || url.startsWith("https://")) {
        return false;
    } else {// ww w .  ja  va2  s .  c o m
        return true;
    }
}

From source file:Main.java

static public String[] splitUri(String uri) {
    if (uri.startsWith("/"))
        uri = uri.substring(1);/*from  w  ww  .  j a  v  a  2 s .c  om*/
    if (uri.endsWith("/"))
        uri = uri.substring(0, uri.length() - 2);
    return uri.split("/");
}

From source file:Main.java

public static String unescapeQuotes(String value) {
    if (value.startsWith("\\\"") && value.endsWith("\\\"")) {
        return value.substring(2, value.length() - 2);
    }/*w  w w . ja v  a2s .co  m*/
    return value;
}

From source file:Main.java

public static String checkURL(String url) {
    if (url.startsWith("http://"))
        return url;
    if (url.startsWith("https://"))
        return url;
    return "http://" + url;
}

From source file:Main.java

private final static String formatURL(String path) {
    if (path.startsWith("http://") || path.startsWith("https://"))
        return path;
    return "http://" + URLEncoder.encode(path);
}

From source file:Main.java

public static String cleanFilename(String filename) {
    if (filename.startsWith("/"))
        return filename.substring(1);
    return filename;
}

From source file:Main.java

public static String getSSIDWithoutQuotes(String ssid) {
    if (ssid.startsWith("\"") && ssid.endsWith("\"")) {
        ssid = ssid.substring(1, ssid.length() - 1);
    }/*from   w w  w .java 2  s  .c o m*/

    return ssid;
}

From source file:Main.java

public static String getIdNameFromId(String pId) {
    if (pId.startsWith("@+id/")) {
        return pId.substring(5);
    } else if (pId.startsWith("@id/")) {
        return pId.substring(4);
    }//from  ww  w.j a va 2s.  co m
    throw new IllegalArgumentException("Wrong id structure: " + pId);
}