List of usage examples for java.lang String split
public String[] split(String regex)
From source file:Main.java
public static float[] toSize(String str, float scale) { String[] strs = str.split(","); return new float[] { toLength(strs[0], scale), toLength(strs[1], scale) }; }
From source file:Main.java
public static String getOtherSpotUser(String spot, String user) { String[] split = spot.split(":"); return split[0].equals(user) ? split[1] : split[0]; }
From source file:Main.java
public static byte[] IPStringToBytes(String ipString) { String[] strs = ipString.split("[.]"); byte[] b = new byte[strs.length]; int index = 0; for (String str : strs) { b[index++] = (byte) (Integer.parseInt(str)); }/*from w w w . j a va2 s . c om*/ return b; }
From source file:Main.java
public static String getStickerPackageId(String contentMsg) { String[] data = contentMsg.split("_"); String packageId = data[0];/*from w ww .j ava 2s .com*/ if (packageId != null) { return packageId; } else { return ""; } }
From source file:Main.java
public static String getStickerId(String contentMsg) { String[] data = contentMsg.split("_"); String idSticker = data[1];/*from w w w . ja va 2 s . c o m*/ if (idSticker != null) { return idSticker; } else { return ""; } }
From source file:Main.java
/** * This method will extract a type from an URI. * /*from w w w . jav a 2 s . c o m*/ * This is a helper like extractFragment (see python sources) that * works just a little different but should suit our needs. * * @param typeUri The URI containing the type (or the type itself) * @return A type (extracted from the URI or left unchanged) */ public static String extractTypeFromURI(String typeUri) { String[] f = typeUri.split("#"); if (f == null || f.length < 2) return typeUri; else return f[1]; }
From source file:Main.java
public static boolean checkValidity(String paramString) { String[] arrayOfString = paramString.split("."); return arrayOfString[(arrayOfString.length - 1)].equals("xml"); }
From source file:Main.java
/** * convert to number of seconds/* w w w. j a v a 2s .com*/ * * @param time * @return */ public static long timeInSeconds(String time) { String[] tempTime = time.split(":"); int mins = Integer.parseInt(tempTime[0]); int sec = Integer.parseInt(tempTime[1]); return mins * 60 + sec; }
From source file:Main.java
public static String changeText(String str, String num) { String strs[] = str.split(" "); return strs[0] + " " + num; }
From source file:Main.java
public static String toStandardFormat(String str) { String[] s = str.split("-"); String tailStr;/*from w ww.j a va 2s .c o m*/ if (s[1].length() == 1) { tailStr = "0" + s[1] + s[2]; } else { tailStr = s[1] + s[2]; } String headStr = Calendar.getInstance().get(Calendar.YEAR) + ""; return headStr + tailStr; }