List of usage examples for java.lang String startsWith
public boolean startsWith(String prefix)
From source file:Main.java
static public String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.startsWith(manufacturer)) { return capitalize(model); } else {//from w w w.j a va 2s. c o m return capitalize(manufacturer) + " " + model; } }
From source file:capital.scalable.restdocs.util.FieldUtil.java
public static boolean isGetter(String javaFieldName) { return javaFieldName.startsWith("get") || javaFieldName.startsWith("is"); }
From source file:Main.java
public static String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.startsWith(manufacturer)) return (capitial(model)); else//from www . ja va 2 s. c o m return capitial(manufacturer) + "" + model; }
From source file:Main.java
/** * Make sure URL starts with http:// or https:// and has a slash * for the path if the path is missing. Examples: * /*from w ww .j a v a 2 s. c o m*/ * foo.org -> http://foo.org/ * http://foo.org -> http://foo.org/ * * @param url * @return */ public static String fixUrl(String url) { if (!url.startsWith("http://") && !url.startsWith("https://")) url = "http://" + url; // Make sure there are at least three slashes (two in http://) int count = 0; for (int i = 0; i < url.length() && count < 3; i++) { if (url.charAt(i) == '/') count++; } if (count == 3) return url; else return url + "/"; }
From source file:Main.java
public static String doesNotExistInEntirePage(final String path) { final String processedPath = (path.startsWith("//")) ? format(".%s", path) : (path.startsWith("(/")) ? format("(./%s", path.substring(2)) : ".//" + path; return format("/html[not(%s)]", processedPath); }
From source file:Main.java
public static boolean isZh(Context context) { Locale locale = context.getResources().getConfiguration().locale; String language = locale.getLanguage(); if (language.startsWith("zh")) return true; else/*w w w . j a v a 2s .co m*/ return false; }
From source file:Main.java
public static String stripStartAndEnd(String s, String start, String end) { if (s.startsWith(start) && s.endsWith(end)) return s.substring(start.length(), s.length() - end.length()); else/*from www . j a v a2 s . c om*/ return s; }
From source file:Main.java
public static String getImageNetPath(String path, String domain) { if (path.startsWith("http://")) { return path; } else {//from w w w . j a v a2 s . c om if (domain.endsWith("/") && path.startsWith("/")) { return domain + path.substring(1); } else if (!domain.endsWith("/") && path.startsWith("/")) { return domain + path; } else if (domain.endsWith("/") && !path.startsWith("/")) { return domain + path; } else { return domain + "/" + path; } } }
From source file:Main.java
public static String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.startsWith(manufacturer)) { return capitalize(model); } else {//from w ww. j av a2 s .c o m return capitalize(manufacturer) + " " + model; } }
From source file:Main.java
/** * Removes the "file://" prefix from the given URI string, if applicable. * If the given URI string doesn't have a "file://" prefix, it is returned unchanged. * * @param uriString the URI string to operate on * @return a path without the "file://" prefix *///from ww w . j a v a 2 s .c o m public static String stripFileProtocol(String uriString) { if (uriString.startsWith("file://")) { return Uri.parse(uriString).getPath(); } return uriString; }