List of usage examples for java.lang String startsWith
public boolean startsWith(String prefix)
From source file:Main.java
public static String getFilePath(String IP, String folder, String fileObject) { String _IP = ""; if (!IP.startsWith("http://")) _IP = "http://" + IP; return _IP + folder + fileObject; }
From source file:Main.java
/** * Returns true if uri is a media uri.// ww w. j a va 2s . co m * * @param uri * @return */ public static boolean isMediaUri(Uri uri) { String uriString = uri.toString(); if (uriString.startsWith(Audio.Media.INTERNAL_CONTENT_URI.toString()) || uriString.startsWith(Audio.Media.EXTERNAL_CONTENT_URI.toString()) || uriString.startsWith(Video.Media.INTERNAL_CONTENT_URI.toString()) || uriString.startsWith(Video.Media.EXTERNAL_CONTENT_URI.toString())) { return true; } else { return false; } }
From source file:Main.java
private static String generateKeyNameForTaintInfo(Set<String> allIntentKeys) { String keyName = keyBaseName; int counter = 0; for (String intentKey : allIntentKeys) { if (intentKey.startsWith(keyBaseName)) { String possibleNumber = intentKey.substring(keyBaseName.length()); if (possibleNumber.length() > 0 && TextUtils.isDigitsOnly(possibleNumber)) { int currentCounter = Integer.parseInt(possibleNumber); counter = currentCounter + 1; }//from ww w . j ava 2 s.c om } } if (counter != 0) keyName += counter; return keyName; }
From source file:Main.java
public static void openLink(Activity activity, String url) { if (url == null) return;/* w ww . j a v a2 s . c om*/ if (!url.startsWith("http://") && !url.startsWith("https://")) url = "http://" + url; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); intent = Intent.createChooser(intent, null); activity.startActivity(intent); }
From source file:Main.java
/** Returns the consumer friendly device name */ public static String getDeviceName() { final String manufacturer = Build.MANUFACTURER; final String model = Build.MODEL; if (model.startsWith(manufacturer)) { return capitalize(model); }//from ww w . j a v a 2 s . com if (manufacturer.equalsIgnoreCase("HTC")) { // make sure "HTC" is fully capitalized. return "HTC " + model; } return capitalize(manufacturer) + " " + model; }
From source file:Main.java
public static String addGetString(String fieldName) { StringBuffer sb = new StringBuffer(); if (fieldName.startsWith("is")) { return fieldName; }//from ww w .ja va 2 s . co m sb.append("get"); sb.append(fieldName.substring(0, 1).toUpperCase()); sb.append(fieldName.substring(1)); return sb.toString(); }
From source file:Main.java
public static String getBooKName(String textPath) { if (textPath == null || "".equalsIgnoreCase(textPath) || textPath.startsWith(".")) { return ""; }//from ww w .ja v a2 s. com return textPath.substring(textPath.lastIndexOf(File.separator) + 1); }
From source file:dev.argent.hive.SqlScriptLoader.java
protected static String stripComments(List<String> list) { StringBuffer buffer = new StringBuffer(); for (String line : list) { if (!line.startsWith("//") && !line.startsWith("--")) { buffer.append(line + "\n"); }//from w ww.jav a 2 s. c o m } return buffer.toString(); }
From source file:com.jaspersoft.jasperserver.api.common.properties.Log4jPropertyChanger.java
static public String parseKey(String key) { assert (key.startsWith(PROPERTY_PREFIX)); return key.substring(PROPERTY_PREFIX.length()); }
From source file:Main.java
public static Map<String, String> parseArguments(String[] args) { Map<String, String> map = new LinkedHashMap<String, String>(); for (String arg : args) { String strs[] = arg.split("\\="); if (strs.length != 2) continue; String key = strs[0]; if (key.startsWith("-")) { key = key.substring(1);/*from ww w . ja v a 2 s .c o m*/ } if (key.startsWith("-")) { key = key.substring(1); } String value = strs[1]; map.put(key, value); } return map; }