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 isIndex(String indexString) {
    return indexString.startsWith("[") && indexString.endsWith("]");
}

From source file:Main.java

public static boolean isFile(String filePath) {
    return filePath.startsWith(FILE_PREFIX) && !filePath.startsWith(ASSET_PREFIX);
}

From source file:Main.java

public static boolean filenameIsFAE(String filename) {
    return filename.startsWith(FAE_PREFIX);
}

From source file:Main.java

private static boolean isStartWithIpNum(String others) {
    return others.startsWith("17951") || others.startsWith("12593") || others.startsWith("17900")
            || others.startsWith("17901") || others.startsWith("17908") || others.startsWith("17909")
            || others.startsWith("17911") || others.startsWith("10193");
}

From source file:Main.java

public static boolean filenameIsCore(String filename) {
    return filename.startsWith(CORE_PREFIX);
}

From source file:Main.java

private static String fixPropValue(String value) {
    if (value.startsWith("\""))
        value = value.substring(1);//from ww w  .ja v  a  2 s . c o  m
    if (value.endsWith("\""))
        value = value.substring(0, value.length() - 1);

    return value;
}

From source file:Main.java

public static UUID createUUIDFromAssignedNumber(String an) {
    if (an.startsWith("0x")) {
        an = an.substring(2);/*  w ww. ja v a  2 s .com*/
    }

    return UUID.fromString(String.format("0000%s-0000-1000-8000-00805f9b34fb", an));
}

From source file:Main.java

public static String processRequest(String request) {
    if (!(request.startsWith("http://") || request.startsWith("https://"))) {
        return "http://" + request;
    }//from  w  ww  .  j a  va 2s .  c o  m
    return request;
}

From source file:Main.java

/**
 * Returns true if the given URL looks like it is from one of the web archives.
 * @param url//from w  w  w  .ja v a  2  s. com
 * @return
 */
public static boolean isArchiveUrl(String url) {
    return (url.startsWith("http://web.archive.org") || url.startsWith("http://api.wayback.archive")
            || url.startsWith("http://wayback.archive-it"));
}

From source file:Main.java

/**
 * Removes '[' and ']' from beginning and end of a String,
 * but only if both are present. //from  w  ww  . j  ava  2 s  .co m
 * @param s
 * @return
 */
public static String chopBraces(String s) {
    if (s.startsWith(STRSQBRACKETSTART) && s.endsWith(STRSQBRACKETEND))
        return s.substring(1, s.length() - 1);
    return s;
}