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

public static String resolveString(Context context, Resources res, String string) {
    if (string.startsWith("@")) {
        String subs = string.substring(1, string.length());
        String[] parts = subs.split("/");
        int id = res.getIdentifier(parts[1], parts[0], context.getPackageName());
        if (id == 0x0) {
            return string;
        }/* ww  w. j av a  2 s. c om*/
        return res.getString(id);
    }
    return string;
}

From source file:Main.java

private static boolean isAudio(String mimeType) {
    return mimeType.startsWith("audio/");
}

From source file:Main.java

/**
 * Returns true if uri is a media uri./*  w  w  w . j  a  v a 2s.  c  o m*/
 * 
 * @param uri
 * @return
 */
public static boolean isMediaUri(String uri) {
    if (uri.startsWith(Audio.Media.INTERNAL_CONTENT_URI.toString())
            || uri.startsWith(Audio.Media.EXTERNAL_CONTENT_URI.toString())
            || uri.startsWith(Video.Media.INTERNAL_CONTENT_URI.toString())
            || uri.startsWith(Video.Media.EXTERNAL_CONTENT_URI.toString())) {
        return true;
    } else {
        return false;
    }
}

From source file:Main.java

private static boolean isImage(String mimeType) {
    return mimeType.startsWith("image/");
}

From source file:Main.java

public static String toInternLink(String title, String url) {
    if (url.startsWith("www."))
        url = "http://" + url;

    return "<a class=\"i-tw-link\" href=\"" + url + "\">" + title + "</a>";
}

From source file:Main.java

public static String nameWithoutJavaBeansPrefix(String rawName) {
    if (rawName.startsWith("get") && !rawName.equals("get")) {
        return rawName.substring(3);
    } else if (rawName.startsWith("is") && !rawName.equals("is")) {
        return rawName.substring(2);
    } else if (rawName.startsWith("set") && !rawName.equals("set")) {
        return rawName.substring(3);
    }//  w  ww.ja  va  2s. c  o m
    return rawName;
}

From source file:Main.java

public static boolean isChinaUnicom(String mobile) {
    return (mobile.startsWith("130") || mobile.startsWith("131") || mobile.startsWith("132")
            || mobile.startsWith("1349") || mobile.startsWith("155") || mobile.startsWith("156")
            || mobile.startsWith("186"));
}

From source file:Main.java

private static String addLocalizableTag(String p_text) {
    if (!p_text.startsWith("<localizable")) {
        p_text = "<localizable>" + p_text + "</localizable>";
    }/* w  ww .  j av  a2  s  . c  om*/

    return p_text;
}

From source file:Main.java

public static boolean isCleartoolOutputValid(String line) {
    return !line.startsWith("cleartool: Error:") && !line.startsWith("Process leaked file descriptors.");
}

From source file:Main.java

@SuppressWarnings("deprecation")
public static String encodeSubscriptionURL(final String url) {
    if (url.startsWith("feed/")) {
        return "feed/" + URLEncoder.encode(url.substring(5));
    } else {/*w w w  . j a  v  a 2 s . c o  m*/
        return url;
    }
}