List of usage examples for java.util StringTokenizer hasMoreTokens
public boolean hasMoreTokens()
From source file:Main.java
/** * Returns a Set of String from a formatted string. * The format is /*from w w w.j a va 2s.c o m*/ * <pre> * <value1>,<value2>...,<value3> * </pre> * * @param str Formatted String. * @return a map of String to Set of String */ public static Set<String> parseStringToSet(String str) { Set<String> set = new HashSet<String>(); StringTokenizer st = new StringTokenizer(str, ","); while (st.hasMoreTokens()) { set.add(st.nextToken().trim()); } return set; }
From source file:Main.java
public static Integer[] getMinSec(String str) { Integer[] data = new Integer[2]; StringTokenizer tokens = new StringTokenizer(str, ","); int counter = 0; while (tokens.hasMoreTokens()) { String next = tokens.nextToken(); data[counter++] = Integer.valueOf(next); }/*w w w. j a v a2s. c o m*/ return data; }
From source file:Main.java
public static String getAtLeastOne(StringTokenizer stringT) { StringBuilder text = new StringBuilder(stringT.nextToken()); while (stringT.hasMoreTokens()) { text.append(' '); text.append(stringT.nextToken()); }//w w w .j a v a2 s .co m return text.toString(); }
From source file:Main.java
/** * Converts a path into a <code>List</code> of element names. * * @param childPath a path. e.g. "aaa:bbb/ccc:ddd/eee" * @return a <code>List</code> of element names. * e.g. "aaa:bbb", "ccc:ddd", "eee".//w ww . j a v a 2 s . c o m */ private static List getElementNames(final String childPath) { List<String> strArray = new ArrayList<>(); if (childPath != null) { StringTokenizer st = new StringTokenizer(childPath, elementDelim); while (st.hasMoreTokens()) { String token = st.nextToken(); if (token.length() > 0) { strArray.add(token); } } } return strArray; }
From source file:Main.java
/** * Parses a string of given stop:line entries into a list */// w w w. ja v a 2 s . c o m public static ArrayList<String> parseString(String list) { ArrayList<String> result = new ArrayList<String>(); StringTokenizer tokenizer = new StringTokenizer(list, ","); while (tokenizer.hasMoreTokens()) { result.add(tokenizer.nextToken()); } return result; }
From source file:Main.java
/** * Converts a path into a <code>List</code> of element names. * * @param childPath a path. e.g. "aaa:bbb/ccc:ddd/eee" * * @return a <code>List</code> of element names. * e.g. "aaa:bbb", "ccc:ddd", "eee". *//* w ww . j ava 2 s .c o m*/ private static List getElementNames(final String childPath) { List strArray = new ArrayList(); if (childPath != null) { StringTokenizer st = new StringTokenizer(childPath, elementDelim); while (st.hasMoreTokens()) { String token = st.nextToken(); if (token.length() > 0) { strArray.add(token); } } } return strArray; }
From source file:Main.java
public static void appendParamValues(StringBuffer params, String tagValues, String tagName, String delim) { if (tagValues != null) { if (delim == null || delim.trim().length() == 0) { delim = ","; }//w w w. ja va 2s .c o m StringTokenizer st = new StringTokenizer(tagValues.trim(), delim); while (st.hasMoreTokens()) { params.append("<" + tagName + " id=\"" + encodeStringForXml(st.nextToken().trim()) + "\"></" + tagName + ">"); } } }
From source file:Main.java
private static boolean initOpenCVLibs(String Libs) { Log.d(TAG, "Trying to init OpenCV libs"); boolean result = true; if ((null != Libs) && (Libs.length() != 0)) { Log.d(TAG, "Trying to load libs by dependency list"); StringTokenizer splitter = new StringTokenizer(Libs, ";"); while (splitter.hasMoreTokens()) { result &= loadLibrary(splitter.nextToken()); }/* w w w . j ava2s . c o m*/ } else { // If dependencies list is not defined or empty. result &= loadLibrary("opencv_java3"); } return result; }
From source file:Main.java
private static boolean initOpenCVLibs(String Libs) { Log.d(TAG, "Trying to init OpenCV libs"); boolean result = true; if ((null != Libs) && (Libs.length() != 0)) { Log.d(TAG, "Trying to load libs by dependency list"); StringTokenizer splitter = new StringTokenizer(Libs, ";"); while (splitter.hasMoreTokens()) { result &= loadLibrary(splitter.nextToken()); }//w w w. j av a2 s . c o m } else { // If dependencies list is not defined or empty. result &= loadLibrary("opencv_java"); } return result; }
From source file:Main.java
public static List parseTokenList(String tokenList) { List result = new ArrayList(); StringTokenizer tokenizer = new StringTokenizer(tokenList, " "); while (tokenizer.hasMoreTokens()) { result.add(tokenizer.nextToken()); }//from ww w. j a va 2 s . c o m return result; }