List of usage examples for java.lang String substring
public String substring(int beginIndex)
From source file:Main.java
/** * judge a image format is gif or not//from w ww .j ava 2 s . co m * * @param imageName * image'name * @return true is gif format, false isn't gif format */ public static boolean isGifFormatImage(String imageName) { String string = imageName.substring(imageName.lastIndexOf(".") + 1); if (string.equalsIgnoreCase(IMAGE_TYPT_GIF)) { return true; } else { return false; } }
From source file:Main.java
/** * @param monitor/*w w w. j a v a 2 s . c om*/ * the host address: tcp://ip:port * @return the port as an int */ public static int extractBasePort(String monitor) { String segment = monitor.substring("tcp://".length()); return Integer.parseInt(segment.substring(segment.indexOf(":") + 1)); }
From source file:Main.java
public static String getPort(String str) { String port;/*from w w w. j ava 2 s . co m*/ String s = str.substring(7); String[] arrayStr = s.split(":"); String temp = arrayStr[1]; String[] temp0 = temp.split("/"); port = temp0[0]; return port; }
From source file:Main.java
/** * Compute the name of the last part of the path. * //from w ww . j a va 2 s . c o m * @param path the path, eg "./elem" or "elem". * @return the name, eg "elem". */ public final static String basename(String path) { return path.substring(path.lastIndexOf('/') + 1); }
From source file:Main.java
public static HashMap<String, String> paserParams(String url) { String params = url.substring(url.indexOf("?") + 1); String[] arr = params.split("&"); HashMap<String, String> maps = new HashMap<String, String>(); for (String s : arr) { maps.put(s.substring(0, s.indexOf("=")), s.substring(s.indexOf("=") + 1)); }/* ww w . j a va2 s . com*/ return maps; }
From source file:Main.java
public static int timeString2TimeInt(String timeString) { int msc = Integer.parseInt(timeString.substring(9)) * 10; int sec = Integer.parseInt(timeString.substring(5, 7)); int min = Integer.parseInt(timeString.substring(2, 4)); int hour = Integer.parseInt(timeString.substring(0, 1)); int totalMsec = msc + sec * 1000 + min * 60000 + hour * 3600000; return totalMsec; }
From source file:Main.java
public static String getSubString(String str, String string, int index) { return str.substring(str.indexOf(string) + index); }
From source file:Main.java
private static String getExtension(String filename) { String extension = filename.substring(filename.lastIndexOf(".") + 1).toLowerCase(); return extension; }
From source file:Main.java
public static String lowerFirst(String str) { return Character.toLowerCase(str.charAt(0)) + str.substring(1); }
From source file:Main.java
private static String getSimpleName(String generatorClassFqName) { return generatorClassFqName.substring(generatorClassFqName.lastIndexOf(".") + 1); }