List of usage examples for java.lang String lastIndexOf
public int lastIndexOf(String str)
From source file:Main.java
public static String getImagePath(String remoteUrl) { String imageName = remoteUrl.substring(remoteUrl.lastIndexOf("/") + 1, remoteUrl.length()); /* String path = PathUtil.getDbManager().getImagePath() + "/" + imageName; EMLog.d("msg", "image path:" + path);*/ return null;//from w w w .j av a 2 s .co m }
From source file:Main.java
public static String getPackageName(String fullyQualifiedClassName) { int lastDot = fullyQualifiedClassName.lastIndexOf('.'); if (lastDot == -1) { return ""; }/* ww w. ja v a 2 s. c o m*/ return fullyQualifiedClassName.substring(0, lastDot); }
From source file:Main.java
public static String getFileNameFromUrl(String value) { if (value.length() > 0) return value.substring(value.lastIndexOf('/') + 1); else/*from w ww . j a v a 2 s . c om*/ return value; }
From source file:Main.java
public static void createDipPath(String file) { String parentFile = file.substring(0, file.lastIndexOf("/")); File file1 = new File(file); File parent = new File(parentFile); if (!file1.exists()) { parent.mkdirs();/*from w w w . j a v a 2 s . com*/ try { file1.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } }
From source file:Main.java
public static String getClassFileName(Class clazz) { String className = clazz.getName(); int lastDotIndex = className.lastIndexOf(PACKAGE_SEPARATOR); return className.substring(lastDotIndex + 1) + CLASS_FILE_SUFFIX; }
From source file:Main.java
public static String getMimeTypeForExtension(String path) { String extension = path; int lastDot = extension.lastIndexOf('.'); if (lastDot != -1) { extension = extension.substring(lastDot + 1); }//from ww w.j a v a2 s .c om // Convert the URI string to lower case to ensure compatibility with MimeTypeMap (see CB-2185). extension = extension.toLowerCase(Locale.getDefault()); if (extension.equals("3ga")) { return "audio/3gpp"; } return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); }
From source file:fi.mikuz.boarder.connection.ConnectionUtils.java
public static String getUrlConnectionId(String url) { return url.substring(url.lastIndexOf("/") + 1); }
From source file:Main.java
public static final String getFileExtension(File file) { String name = file.getName(); try {//from w w w.jav a2 s . co m return name.substring(name.lastIndexOf(".") + 1); } catch (Exception e) { return ""; } }
From source file:net.bpelunit.util.FileUtil.java
public static String getFileNameWithoutSuffix(String fileName) { int lastIndexOf = fileName.lastIndexOf("."); if (lastIndexOf >= 0) { return fileName.substring(0, lastIndexOf); } else {/* w ww .j av a 2s . c o m*/ return fileName; } }
From source file:Main.java
public static String getPicNameFromUrl(String paramStr) { String picName = null;// ww w . jav a 2 s . c o m picName = paramStr.substring(paramStr.lastIndexOf("/") + 1, paramStr.length()); return picName; }